Exemple #1
0
static __inline void vibrator_onOff(char onOff)
{
  unsigned int arg1, arg2=0;
  int ret;
  if(onOff)
  {
    arg1 = SMEM_PC_OEM_LED_CTL_VIB_ON;
    PM_LOG_EVENT(PM_LOG_ON, PM_LOG_VIBRATOR);
    jiff_vib_on_timeout = jiffies + 5*HZ;
  }
  else
  {
    arg1 = SMEM_PC_OEM_LED_CTL_VIB_OFF;
    PM_LOG_EVENT(PM_LOG_OFF, PM_LOG_VIBRATOR);
  }
  ret = cust_mproc_comm1(&arg1,&arg2);
  
  if(ret != 0)
  {
    MSG2("VIB %s: FAIL!", onOff?"ON":"OFF");
    jiff_vib_on_timeout = jiffies + 30*24*60*60*HZ;  
  }
  else
  {
    if(onOff == 0)  
    {
      if(time_after(jiffies, jiff_vib_on_timeout))
        MSG2("VIB OFF! Wait more than 5 sec after VIB ON");
      jiff_vib_on_timeout = jiffies + 30*24*60*60*HZ;  
    }
  }
}
Exemple #2
0
FILE *
findFileInPath(char *name, char *subdir)
{
    register int i;
    char buf[PATH_MAX];
    FILE *fp;

    if (name[0] == '/')
    {
        fp = fopen(name, "r");
        if ((verbose > 7) || ((!fp) && (verbose > 0)))
            MSG2("%s file %s\n", (fp ? "Found" : "Didn't find"), name);
        return fp;
    }
    for (i = 0; (i < numInclPath); i++)
    {
        if ((strlen(inclPath[i]) + strlen(subdir) + strlen(name) + 2) >
            PATH_MAX)
        {
            VMSG3(0, "Path too long (%s/%s%s). Ignored.\n", inclPath[i],
                  subdir, name);
            continue;
        }
        sprintf(buf, "%s/%s%s", inclPath[i], subdir, name);
        fp = fopen(name, "r");
        if ((verbose > 7) || ((!fp) && (verbose > 5)))
            MSG2("%s file %s\n", (fp ? "Found" : "Didn't find"), buf);
        if (fp != NULL)
            return fp;
    }
    return NULL;
}
Exemple #3
0
static FILE * 
TT_OpenTabFile_(int id)
{
  char *fn,*dir;
  FILE* f;
  int   l;

  if ( (dir=getenv("TT_DIR")) == NULL ) dir = TTDir;
  l  = strlen( dir ) + 12 ;
  /* MSG2("length of TTDir = \"%s\" is %i bytes\n",TTDir,strlen( TTDir ));*/
  fn = malloc( l );
  /* MSG2("Malloc %i bytes for Filename returns 0x%8.8X\n",l,fn);*/
  sprintf(fn,"%s/ROC%2.2i.tab",dir,id);
  nline = 0;
  MSG2("Open TT file \"%s\" for id # %i\n",fn,id);

  if( (f=fopen(fn,"r")) == NULL )
  {
	MSG2("Can't open file \"%s\" for TT # %i ==> FATAL !!!\n",fn,id);
	free(fn);
	return (void *)NULL;	
  }

  free(fn);
  return (void *)f;
}
Exemple #4
0
FILE *
findFileInPath(char *name)
{
    register int i;
    char buf[PATH_MAX];
    FILE *fp;

    if (name[0] == '/')
    {
        fp = fopen(name, "r");
        if ((verbose > 7) || ((!fp) && (verbose > 0)))
            MSG2("%s file %s\n", (fp ? "Found" : "Didn't find"), name);
        return fp;
    }
    for (i = 0; (i < inclPath.num); i++)
    {
        if (snprintf(buf, PATH_MAX, "%s/%s", inclPath.item[i], name) >=
            PATH_MAX)
        {
            VMSG2(0, "Path too long (%s/%s). Ignored.\n", inclPath.item[i],
                  name);
            continue;
        }
        fp = fopen(buf, "r");
        if ((verbose > 7) || ((!fp) && (verbose > 5)))
            MSG2("%s file %s\n", (fp ? "Found" : "Didn't find"), buf);
        if (fp != NULL)
            return fp;
    }
    return NULL;
}
/**
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;
}
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);
}
Exemple #7
0
/*
 * 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;
}
Exemple #8
0
int
output_send_data(char* cmd, OutputModule *output, int wfr)
{
    int ret;
    GString *response;

    if (output == NULL) return -1;
    if (cmd == NULL) return -1;
    
    ret = safe_write(output->pipe_in[1], cmd, strlen(cmd));
    fflush(NULL);
    if (ret == -1){
        MSG(2, "Error: Broken pipe to module.");        
        output->working = 0;
        speaking_module = NULL;
        output_check_module(output);
        return -1;   /* Broken pipe */
    }
    MSG2(5, "output_module", "Command sent to output module: |%s| (%d)", cmd, wfr);
    
    if (wfr){                   /* wait for reply? */	
	int ret = 0;
	response = output_read_reply(output);
	if (response == NULL) return -1;

        MSG2(5, "output_module", "Reply from output module: |%s|", response->str);

	switch (response->str[0]){
	    case '3':
		MSG(2, "Error: Module reported error in request from speechd (code 3xx): %s.", response->str);
		ret = -2; /* User (speechd) side error */
		break;

	    case '4':
		MSG(2, "Error: Module reported error in itself (code 4xx): %s", response->str);
		ret = -3; /* Module side error */
		break;

	    case '2':
		ret = 0;
		break;
	    default:                  /* unknown response */
		MSG(3, "Unknown response from output module!");
		ret = -3;
		break;
	}
    g_string_free(response, TRUE);
    return ret;
    }       
    
    return 0;
}
/*
 * Size method
 */
void fileio::size(const char* aFileName, t_uint32* aSizePtr)
{
    ASYNC_IN0("");
    FILE* theFile = NULL;

    // Sanity check
    if( aFileName == NULL || aSizePtr == NULL)
    {
        // bad parameter
        MSG2("Bad parameter: aFileName=%p, aSizePtr=%p\n", aFileName, aSizePtr);
        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;
    }

    // Seek to end of file
    MSG1("Seeking to end of file '%s'\n", aFileName);
    if( fseek( theFile, 0, SEEK_END) != 0)
    {
        // seek failed
        MSG0("Seek failed");
        MSG1("Closing file '%s'\n", aFileName);
        fclose(theFile);
        response.fileIoResponse(FILE_IO_SEEK_FAILED);
        ASYNC_OUT0("");
        return;
    }

    // Retrieve file size
    *aSizePtr = (t_uint32)ftell(theFile);
    MSG2("File '%s' size %ld\n", aFileName, *aSizePtr);

    // File size sucessfully retrieved
    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;
}
SCF_STATE CAM_SM::PowerUp_STC_QueryId(s_scf_event const *e) {
	switch (e->sig) {
		case SCF_STATE_ENTRY_SIG:
		{
			ENTRY;
			// Ask the next block ID and toggle the coin
			MSG2("   Query Block[%d], coin state=%d\n", iCurrentFwSubBlockIndex, (int)iStatusCoin);
			OstTraceFiltStatic2(TRACE_DEBUG, "   Query Block[%d], coin state=%d", (&mENSComponent), iCurrentFwSubBlockIndex, (int)iStatusCoin);
			pIspctlCom->queuePE(Sensor_Tuning_Control_u16_SelectedSubBlockIdIndex_Byte0,(t_uint32)iCurrentFwSubBlockIndex);
			pIspctlCom->queuePE(Sensor_Tuning_Control_e_Coin_SubBlock_Control_Byte0,(t_uint32)(iStatusCoin==Coin_e_Heads ? Coin_e_Tails : Coin_e_Heads));
			pIspctlCom->processQueue();
			return 0;
		}
		case EVT_ISPCTL_LIST_INFO_SIG:
		{
			MSG0("PowerUp_STC_QueryId-EVT_ISPCTL_LIST_INFO_SIG\n");
			OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_QueryId-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent));
			if (e->type.ispctlInfo.info_id != ISP_WRITELIST_DONE) break;
			SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_CheckCoin);
			return 0;
		}
		case SCF_STATE_EXIT_SIG:
		{
			EXIT;
			return 0;
		}
		default: break;
	}
	return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot);
}
Exemple #12
0
void presub(unsigned long from,unsigned long to,stralloc *subject,
	    int factype,	/* action type (AC_THREAD,AC_GET,AC_DIGEST) */
	    char format)	/* output format type (see idx.h) */
/* Starts within header, outputs "subject" and optional headers, terminates*/
/* header and handles output before table-of-contents                      */
{
  switch(format) {
    case MIME:
    case VIRGIN:
    case NATIVE:
    case MIXED:
        hdr_mime((format == MIXED) ? CTYPE_MULTIPART : CTYPE_DIGEST);
	hdr_add2("Subject: ",subject->s,subject->len);
	hdr_boundary(0);
	hdr_ctype(CTYPE_TEXT);
	hdr_transferenc();	/* content-transfer-enc header if needed */
	break;
    case RFC1153:
        hdr_mime(CTYPE_TEXT);
	hdr_add2("Subject: ",subject->s,subject->len);
	qmail_puts(&qq,"\n");
	flagcd = '\0';	/* We make 8-bit messages, not QP/base64 for rfc1153 */
        break;		/* Since messages themselves aren't encoded */
    }
    if (!stralloc_cats(subject,"\n\n")) die_nomem();
    code_qput(subject->s,subject->len);
    if (format != NATIVE && factype != AC_THREAD && factype != AC_INDEX) {
      strnum[fmt_ulong(strnum,from)] = 0;
      strnum2[fmt_ulong(strnum2,to)] = 0;
      code_qputs(MSG2(TXT_TOP_TOPICS,strnum,strnum2));
    }
}
/*
 * tuningloader_fileio write method
 */
t_fileio_error tuningloader_fileio::write(const void* pSrcBuffer, int aNumBytes)
{
    IN0("\n");
    size_t iNumBytesWritten = 0;

    // Sanity check
    if( pSrcBuffer == NULL || aNumBytes == 0)
    {
        // Bad parameter
        MSG2("Bad parameter: pSrcBuffer=%p aNumBytes=%d\n", pSrcBuffer, aNumBytes);
        OUTR(" ", FILEIO_BAD_ARGUMENT);
        return FILEIO_BAD_ARGUMENT;
    }
    if( pFile == NULL)
    {
        // File is not open
        MSG0("File not open\n");
        OUTR(" ", FILEIO_FILE_NOT_OPEN);
        return FILEIO_FILE_NOT_OPEN;
    }

    // Write to file
    iNumBytesWritten = fwrite( pSrcBuffer, 1, (size_t)aNumBytes, pFile);
    if( iNumBytesWritten != (size_t)aNumBytes )
    {
        // Could not write into file
        MSG0("Write failed, closing file\n");
        OUTR(" ", FILEIO_WRITE_FAILED);
        return FILEIO_WRITE_FAILED;
    }

    // Sucessfully wrote to file
    OUTR(" ",FILEIO_OK);
    return FILEIO_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;
}
/**
Return the ExtraData structur associated to given index
*/
int WRAPPER_OPENMAX_API openmax_processor::GetExtraData(const _tConvertionConfig &Config, const int aStructType, char *&pStruct)
//*************************************************************************************************************
{ 
#if 0
	/* get extradata start pointer */
	const OMX_BUFFERHEADERTYPE* pOmxBufHdr=Config.Input.pBufferHdr;
	OMX_U8* pEnd=pOmxBufHdr->pBuffer + pOmxBufHdr->nAllocLen;
	OMX_U8* pExtraData = pOmxBufHdr->pBuffer + pOmxBufHdr->nOffset + pOmxBufHdr->nFilledLen;
	OMX_OTHER_EXTRADATATYPE* pCurExtra = (OMX_OTHER_EXTRADATATYPE*)(((OMX_U32)pExtraData+ 3) & ~0x3);
	while ( ((OMX_U8*)pCurExtra < pEnd) &&  (pCurExtra->nSize>0) )
	{
		if( pCurExtra->eType==  (OMX_EXTRADATATYPE)aStructType)
		{ //found 
			unsigned int ComputeSize=(pCurExtra->nDataSize + sizeof(OMX_OTHER_EXTRADATATYPE) -1 + 3) &~3;
			if ( ComputeSize > pCurExtra->nSize)
			{ //Corrupted metadata
				MSG2("*** CORRUPTED metadata, sizes are not equal %d %d\n",  ComputeSize, pCurExtra->nSize);
				ReportError(eError_CorruptedMetada, "*** CORRUPTED metadata, sizes are not equal %d %d\n",  ComputeSize, pCurExtra->nSize);
			}
			pStruct=(char *)pCurExtra->data;
			return(S_OK);
		}
		pExtraData +=pCurExtra->nSize;
		//round pointer
		pCurExtra = (OMX_OTHER_EXTRADATATYPE*)(((OMX_U32)pExtraData+ 3) & ~0x3);
	}
	pStruct=NULL;
	return(-1);
#else
	return(::GetExtraData(Config.Input.pBufferHdr, aStructType, pStruct));
#endif
}
Exemple #16
0
/*
 * This function sets the OMX setting value
 */
void CSharpeningDamperLR::SetOmxMapping(float aGain, float aOffset)
{
   iScaleFactorGain   = aGain;
   iScaleFactorOffset = aOffset;
   MSG2("OMX Mapping: gain=%f, offset=%f\n", iScaleFactorGain, iScaleFactorOffset);
   OstTraceFiltStatic2(TRACE_DEBUG, "OMX Mapping: gain=%f, offset=%f", (mTraceObject), iScaleFactorGain, iScaleFactorOffset);
}
/*
 * This function launches the loading of the firmware tuning data
 */
TuningLoaderMgrError_t CTuningLoaderManager::loadFirmwareTuningData(const t_camera_info*    pCamInfo,
                                                                    const t_fw_blocks_info* pFwBlocksInfo)
{
    IN0("\n");
    OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::loadFirmwareTuningData", (mTraceObject));

    // Check if constructed
    if(iNmfInstance == NULL) {
        MSG0("Instance not constructed\n");
        OstTraceFiltStatic0(TRACE_DEBUG, "Instance not constructed", (mTraceObject));
        OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED);
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFirmwareTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED);
        return TUNING_LOADER_MGR_NOT_CONSTRUCTED;
    }

    // Aguments sanity check
    if( pCamInfo == NULL || pFwBlocksInfo == NULL)
    {
        MSG2("Bad argument: pCamInfo=%p, pFwBlocksInfo=%p\n", pCamInfo, pFwBlocksInfo);
        OstTraceFiltStatic2(TRACE_ERROR, "Bad argument: pCamInfo=0x%x, pFwBlocksInfo=0x%x", (mTraceObject), (t_uint32)pCamInfo, (t_uint32)pFwBlocksInfo);
        OUTR(" ",TUNING_LOADER_MGR_BAD_ARGUMENT);
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFirmwareTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_BAD_ARGUMENT);
        return TUNING_LOADER_MGR_BAD_ARGUMENT;
    }

    // Send command to NMF
    MSG0("Send 'loadFirmwareTuning' command to NMF\n");
    OstTraceFiltStatic0(TRACE_DEBUG, "Send 'loadFirmwareTuning' command to NMF", (mTraceObject));
    iNmfQueryIntf.loadFirmwareTuning(*pCamInfo, *pFwBlocksInfo);

    OUTR(" ",TUNING_LOADER_MGR_OK);
    OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFirmwareTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_OK);
    return TUNING_LOADER_MGR_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;
}
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::sendCommand(OMX_COMMANDTYPE eCmd, OMX_U32 nData)
//*************************************************************************************************************
{ //By default just call the base class
	MSG2("sendCommand %s(%ld)\n", GetStringOmxCommand(eCmd), nData);
	OMX_ERRORTYPE err=NmfHost_ProcessingComponent::sendCommand(eCmd, nData);
	return(err);
}
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::fillThisBuffer(OMX_BUFFERHEADERTYPE* pBufferHdr)
//*************************************************************************************************************
{ //By default just call the base class
	MSG2("::fillThisBuffer sent to Port[%u](BufferHdr=%p)\n", (unsigned int)pBufferHdr->nOutputPortIndex, pBufferHdr);
	OMX_ERRORTYPE err=NmfHost_ProcessingComponent::fillThisBuffer(pBufferHdr);
	return(err);
}
/*
 * 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;
}
Exemple #22
0
/*
 * This function computes the dampers and queues the Page Elements
 */
t_damper_error_code CNoiseModelDamper::ComputeAndQueuePEs( CIspctlCom*                 pIspctlCom,
                                                           const t_damper_base_values* pBaseValues,
                                                           const float                 aAverageDigitalGain)
{
   IN0("\n");
   OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseModelDamper::ComputeAndQueuePEs", (mTraceObject));
   float pDampedValues[1] = { 0.0 };
   float fUserFrameSigma = 0.0;
   t_damper_error_code err = DAMPER_OK;

   // Evaluate Noise Model dampers
   err = DoEvaluate( pBaseValues, pDampedValues);
   if(err!=DAMPER_OK)
   {
      MSG1("Evaluation failed: err=%d\n", err);
      OstTraceFiltStatic1(TRACE_DEBUG, "Evaluation failed: err=%d", (mTraceObject), err);
      OUTR(" ",err);
      OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err);
      return err;
   }

   // Scale the damper output by the reference Shading Correction Gain, Average Digital Gain and pipeline dynamic range
   // NOTE: the damper output is now the noise sigma at pipeline input, normalized to pipeline dynamic range
   MSG2("iShadingCorrectionGain=%f, aAverageDigitalGain=%f\n", iShadingCorrectionGain, aAverageDigitalGain);
   OstTraceFiltStatic2(TRACE_DEBUG, "iShadingCorrectionGain=%f, aAverageDigitalGain=%f", (mTraceObject), iShadingCorrectionGain, aAverageDigitalGain);
   fUserFrameSigma = pDampedValues[0] * iShadingCorrectionGain * aAverageDigitalGain  * 4095.0;

   // Clip against hardware limit
   if(fUserFrameSigma >= 1024) {
      fUserFrameSigma = 1024;
   }

   // Queue the Page Elements
   MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(DusterControl_u16_FrameSigma_Byte0), fUserFrameSigma);
   OstTraceFiltStatic1(TRACE_DEBUG, "DusterControl_u16_FrameSigma = %f", (mTraceObject), fUserFrameSigma);
   pIspctlCom->queuePE( DusterControl_u16_FrameSigma_Byte0, (t_uint32)fUserFrameSigma);

   // Done
   OUTR(" ",DAMPER_OK);
   OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK);
   return DAMPER_OK;
}
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;
}
void openmax_processor::fsmInit(fsmInit_t initFsm)
//*************************************************************************************************************
{ //Make the initialisation of ports
	IN0("\n");
	if (initFsm.traceInfoAddr)
	{
		setTraceInfo(initFsm.traceInfoAddr, initFsm.id1);
	}
	portInformation *pPortInfo;
	Port *pPort;
	NMF::InterfaceReference *pInterfaceRef;
	const size_t NbPorts=GetNbPorts();
	for (size_t portIndex=0; portIndex < NbPorts ; ++portIndex)
	{
		pPort=GetPort(portIndex);
		pPortInfo=GetPortInfo(portIndex);
		pPortInfo->AllocateBufferHeader();

		if (pPortInfo->direction== OMX_DirInput)
		{ // for input
			pInterfaceRef=&mProcessorTemplate.emptybufferdone[portIndex]; // NMF 'return' interface
		}
		else
		{ //for output
			pInterfaceRef=&mProcessorTemplate.fillbufferdone[portIndex]; // NMF 'return' interface
		}

		pPort->init(pPortInfo->direction==OMX_DirInput?InputPort: OutputPort, // Direction
			false /*(bool)pPortInfo->bufferSupplier*/, // Buffer supplier
			true,                        // isHWPort ca fait quoi?
			NULL,                       // sharingPort
			pPortInfo->BufferHeaderList,
			pPortInfo->fifoSize,        // bufferCount (FIFO size )
			pInterfaceRef,              // NMF 'return' interface
			portIndex,                  // port index
			(initFsm.portsDisabled & (1 << portIndex) )?true:false,
			(initFsm.portsTunneled & (1 << portIndex) )?true:false,
			this // owner
		);
		MSG4("%s->InitPort(%d) Direction=%d Fifo=%d \n", GetComponentName(), portIndex, pPortInfo->direction, pPortInfo->fifoSize);
		for (int i=0; i< pPortInfo->fifoSize; ++i)
		{
			MSG2("BufferHeader[i]=%p \n", i, pPortInfo->BufferHeaderList[i]);
		}
		MSG0("\n");
	}
	init(NbPorts, m_pPort, &proxy /* Event Handler */, &me /* Postevent */, false);

	//Now call user init
	UserOpen();
	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;
}
/*
 * tuningloader_fileio read method
 */
t_fileio_error tuningloader_fileio::read(void* pDestBuffer, int aNumBytes)
{
    IN0("\n");
    size_t iNumBytesRead = 0;

    // Sanity check
    if( pDestBuffer == NULL || aNumBytes == 0)
    {
        // Bad parameter
        MSG2("Bad parameter: pDestBuffer=%p aNumBytes=%d\n", pDestBuffer, aNumBytes);
        OUTR(" ", FILEIO_BAD_ARGUMENT);
        return FILEIO_BAD_ARGUMENT;
    }
    if( pFile == NULL)
    {
        // File is not open
        MSG0("File not open\n");
        OUTR(" ", FILEIO_FILE_NOT_OPEN);
        return FILEIO_FILE_NOT_OPEN;
    }

    // Read the file
    MSG1("Reading %d bytes from file\n", aNumBytes);
    iNumBytesRead = fread( pDestBuffer, 1, (size_t)aNumBytes, pFile);
    if( iNumBytesRead != (size_t)aNumBytes )
    {
        // Could not read the file
        MSG2("Read failed, expected %d bytes, got %d bytes\n", aNumBytes, iNumBytesRead);
        OUTR(" ", FILEIO_READ_FAILED);
        return FILEIO_READ_FAILED;
    }

    // File sucessfully read
    OUTR(" ",FILEIO_OK);
    return FILEIO_OK;
}
Exemple #27
0
char*
output_read_reply2(OutputModule *output)
{
    int bytes;
    char *reply;
    

    reply = malloc( 1024 * sizeof(char));

    bytes = read(output->pipe_out[0], reply, 1024);
    reply[bytes] = 0;
    MSG2(1, "output_module", "2Read: %d bytes: <%s>", bytes, reply);

    return reply;
}
Exemple #28
0
int thzelctc(Process *proc, char * port)
{
	int elem_no = 0;
	char port_name[100];
	char * p = strchr(port, '[');
	char * q;
	if (p == 0) 
		strcpy (port_name, port);
	else {
		q = strchr(p, ']');
		long n = q - p - 1;
		char no[10];		
		strncpy(no, p + 1, n);
		elem_no = atoi(no);
		char * r = port;
		strncpy (port_name, port, p - r);
		port_name[p - r] = '\0';
	}
	cp * cpp = proc -> in_cps;
	while (cpp != 0)
	{

		if (0 == strcmp(cpp -> port_name, port_name)){
			break;
		}

		cpp = cpp -> succ;
	}
	if (cpp == 0) {
		cpp = proc -> out_cps;
		while (cpp != 0)
		{

			if (0 == strcmp(cpp -> port_name, port_name)){
				break;
			}

			cpp = cpp -> succ;
		}
		if (cpp == 0) {
			MSG2 ("%s Port %s not found\n", proc -> procname, port_name);	
			return -1;
		}
	}
	return cpp -> elem_count;
}
/*
 * Open a file
 */
t_fileio_error tuningloader_fileio::open(const char*   pFileName,
                                         t_fileio_mode aFileIoMode)
{
    IN0("\n");

    const char* pOpenMode = aFileIoMode==FILEIO_MODE_READ_ONLY ? "rb" : "wb";

    // Close file in case previous one is still open
    if(pFile!=NULL) {
        MSG0("Attempting to open a new file without having closed previous one\n");
        OUTR(" ",FILEIO_FILE_NOT_CLOSED);
        return FILEIO_FILE_NOT_CLOSED;
    }

    // Open file
    MSG2("Opening file (%s only) '%s'\n", aFileIoMode==FILEIO_MODE_READ_ONLY?"read":"write", pFileName);
    pFile = fopen( pFileName, pOpenMode);
    if(pFile==NULL)
    {
       MSG0("Failed to open file\n");
       OUTR(" ",FILEIO_OPEN_FAILED);
       return FILEIO_OPEN_FAILED;
    }

    // File sucessfully open
    snprintf(iFullyQualifiedFileName, sizeof(iFullyQualifiedFileName), "%s", pFileName);
    if(aFileIoMode==FILEIO_MODE_READ_ONLY)
    {
       // File open in "read only" mode: retrieve file size
       if( fseek( pFile, 0, SEEK_END) != 0)
       {
          // Seek failed
          MSG0("Failed to seek to end of file, aborting\n");
          close();
          OUTR(" ", FILEIO_SEEK_FAILED);
          return FILEIO_SEEK_FAILED;
      }
      iFileSize = (int)ftell(pFile);
      (void)fseek(pFile, 0, SEEK_SET);
   }
   MSG1("File sucessfully open, size=%d\n", iFileSize);
   OUTR(" ", FILEIO_OK);
   return FILEIO_OK;
}
Exemple #30
0
camSharedMemError_t CCamSharedMemory::cacheClean(camSharedMemChunkId_t chunkId)
{
    IN0("\n");
    OstTraceFiltStatic0(TRACE_FLOW, "Entry CCamSharedMemory::cacheClean", (mTraceObject));
    if (state != CCamSharedMemory::CAM_SHARED_MEM_STATE_OPEN) {
        OUT0("\n");
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheClean (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_STATE);
        return CAM_SHARED_MEM_ERR_BAD_STATE;
    }
    if (chunkId >= CAM_SHARED_MEM_CHUNK_MAX) {
        OUT0("\n");
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheClean (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_PARAMETER);
        return CAM_SHARED_MEM_ERR_BAD_PARAMETER;
    }
#ifndef CAM_SHARED_MEM_DEBUG
    /* Exceptionally allow cleaning before the chunk has been requested. For memory debug purpose. */
    if (! abBusyChunks[chunkId]) {
        OUT0("\n");
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheClean (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_PRECONDITION);
        return CAM_SHARED_MEM_ERR_BAD_PRECONDITION;
    }
#endif /* CAM_SHARED_MEM_DEBUG */
    OMX_U32 aPhysAddr; // out
    /* OMX_ERRORTYPE e_ret = sharedBufferPoolId->CacheSync(MMHwBuffer::ESyncBeforeReadHwOperation,
     * After the switch to the 2.6.35 kernel version, MMHwBuffer cache synchronization has changed
     * (switch from pmem to hwmem driver), with an impact on the API => sync before read AND before write are mandatory. */
    OMX_ERRORTYPE e_ret1 = sharedBufferPoolId->CacheSync(MMHwBuffer::ESyncBeforeReadHwOperation,
            (OMX_U32) aChunks[chunkId].armLogicalAddress,
            aChunks[chunkId].size, aPhysAddr);

    OMX_ERRORTYPE e_ret2 = sharedBufferPoolId->CacheSync(MMHwBuffer::ESyncBeforeWriteHwOperation,
            (OMX_U32) aChunks[chunkId].armLogicalAddress,
            aChunks[chunkId].size, aPhysAddr);
    if ((e_ret1 != OMX_ErrorNone) || (e_ret2 != OMX_ErrorNone)){
        MSG2("Problem cleaning data cache (err=%d);%d\n", e_ret1, e_ret2);
        OstTraceFiltStatic2(TRACE_DEBUG, "Problem cleaning data cache (err=%d);%d", (mTraceObject), e_ret1, e_ret2);
        OUT0("");
        OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheClean (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_NO_RESOURCE);
        return CAM_SHARED_MEM_ERR_NO_RESOURCE;
    }
    OUT0("\n");
    OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheClean (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_NONE);
    return CAM_SHARED_MEM_ERR_NONE;
}