Ejemplo n.º 1
0
Archivo: osa_que.c Proyecto: 119/ipnc
int OSA_queCreate(OSA_QueHndl *hndl, Uint32 maxLen)
{
  pthread_mutexattr_t mutex_attr;
  pthread_condattr_t cond_attr;
  int status=OSA_SOK;

  hndl->curRd = hndl->curWr = 0;
  hndl->count = 0;
  hndl->len   = maxLen;
  hndl->queue = OSA_memAlloc(sizeof(Int32)*hndl->len);
  
  if(hndl->queue==NULL) {
    OSA_ERROR("OSA_queCreate() = %d \r\n", status);
    return OSA_EFAIL;
  }
 
  status |= pthread_mutexattr_init(&mutex_attr);
  status |= pthread_condattr_init(&cond_attr);  
  
  status |= pthread_mutex_init(&hndl->lock, &mutex_attr);
  status |= pthread_cond_init(&hndl->condRd, &cond_attr);    
  status |= pthread_cond_init(&hndl->condWr, &cond_attr);  

  if(status!=OSA_SOK)
    OSA_ERROR("OSA_queCreate() = %d \r\n", status);
    
  pthread_condattr_destroy(&cond_attr);
  pthread_mutexattr_destroy(&mutex_attr);
    
  return status;
}
Ejemplo n.º 2
0
Archivo: avServer.c Proyecto: 119/ipnc
OSA_BufInfo *AVSERVER_bufPutFull(int tskId, int streamId, int bufId)
{
  OSA_BufHndl *pBufHndl;
  OSA_TskHndl *pTskHndl;
  int status;

  status = AVSERVER_bufGetNextTskInfo(tskId, streamId, &pBufHndl, &pTskHndl);
  if(status!=OSA_SOK) {
    OSA_ERROR("AVSERVER_bufGetNextTskInfo(%d, %d)\n", tskId, streamId);
    return NULL;
  }

  status = OSA_bufPutFull(pBufHndl, bufId);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_bufPutFull(%d, %d, %d)\n", tskId, streamId, bufId);
    return NULL;
  }

  status = OSA_tskSendMsg(pTskHndl, NULL, AVSERVER_CMD_NEW_DATA, (void*)streamId, 0);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_tskSendMsg(AVSERVER_CMD_NEW_DATA, %d, %d)\n", tskId, streamId);
    return NULL;
  }

  return OSA_bufGetBufInfo(pBufHndl, bufId);
}
Ejemplo n.º 3
0
int AVSERVER_init()
{
  int status;

  #ifdef AVSERVER_DEBUG_API
  OSA_printf(" AVSERVER API: Creating TSKs.\n");
  #endif

  status = DRV_init();
  if(status!=OSA_SOK) {
    OSA_ERROR("DRV_init()\n");
    return status;
  }

  status = ALG_sysInit();
  if(status!=OSA_SOK) {
    OSA_ERROR("ALG_sysInit()\n");
    DRV_exit();
    return status;
  }

  memset(&gAVSERVER_config, 0, sizeof(gAVSERVER_config));
  memset(&gVIDEO_ctrl, 0, sizeof(gVIDEO_ctrl));
  memset(&gAVSERVER_ctrl, 0, sizeof(gAVSERVER_ctrl));

  status |= OSA_mutexCreate(&gAVSERVER_ctrl.lockMutex);

  status |= VIDEO_captureCreate();
  //status |= VIDEO_resizeCreate();
  status |= VIDEO_streamCreate();
  status |= VIDEO_displayCreate();
  //status |= VIDEO_ldcCreate();
  //status |= VIDEO_vnfCreate();
  //status |= VIDEO_vsCreate();
  status |= VIDEO_aewbCreate();
  //status |= VIDEO_fdCreate();
  status |= VIDEO_encodeCreate();
  status |= VIDEO_swosdCreate();
  //status |= VIDEO_encryptCreate();
  status |= VIDEO_motionCreate();
  //status |= AUDIO_audioCreate();
  //status |= AUDIOPLAY_audioCreate();
  status |= AVSERVER_mainCreate();

  if(status!=OSA_SOK) {
    OSA_ERROR("AVSERVER_init()\n");
    ALG_sysExit();
    DRV_exit();
    return status;
  }

  #ifdef AVSERVER_DEBUG_API
  OSA_printf(" AVSERVER API: Creating TSKs...DONE\n");
  #endif

  return status;
}
Ejemplo n.º 4
0
int ALG_jpgEncSetQvalue(void *hndl, int qValue)
{
  ALG_JpgEncObj  *pObj = (ALG_JpgEncObj*)hndl;
  XDAS_Int32 status;

  if(pObj==NULL)
    return OSA_EFAIL;

  pObj->dynamicParams.size = sizeof(IMGENC1_DynamicParams);
  pObj->dynamicParams.numAU = XDM_DEFAULT;

  if(pObj->createPrm.dataFormat==ALG_VID_DATA_FORMAT_YUV422)
    pObj->dynamicParams.inputChromaFormat  = XDM_YUV_422ILE;
  else
    pObj->dynamicParams.inputChromaFormat  = XDM_YUV_420SP;

  if(qValue < ALG_JPG_ENC_Q_VALUE_MIN)
    qValue = ALG_JPG_ENC_Q_VALUE_MIN;
  if(qValue > ALG_JPG_ENC_Q_VALUE_MAX)
    qValue = ALG_JPG_ENC_Q_VALUE_MAX;

  pObj->dynamicParams.inputWidth      = pObj->createPrm.width;
  pObj->dynamicParams.inputHeight     = pObj->createPrm.height;
  pObj->dynamicParams.captureWidth    = (pObj->createPrm.offsetH>pObj->createPrm.width)?pObj->createPrm.offsetH:pObj->createPrm.width;
  pObj->dynamicParams.generateHeader  = XDM_ENCODE_AU;
  pObj->dynamicParams.qValue          = qValue;

  /* Set video encoder dynamic parameters */
  pObj->encStatus.size = sizeof(pObj->encStatus);
  pObj->encStatus.data.buf = NULL;

  status = IMGENC1_control(pObj->hEncode, XDM_SETPARAMS, &pObj->dynamicParams, &pObj->encStatus);

  if (status != IMGENC1_EOK) {
    OSA_ERROR("XDM_SETPARAMS failed, status=%ld\n", status);
    return OSA_EFAIL;
  }

  pObj->encStatus.data.buf = NULL;

  status = IMGENC1_control(pObj->hEncode, XDM_GETBUFINFO, &pObj->dynamicParams, &pObj->encStatus);

  if (status != IMGENC1_EOK) {
      OSA_ERROR("XDM_GETBUFINFO failed, status=%ld\n", status);
      return OSA_EFAIL;
  }

  #ifdef ALG_DEBUG
  OSA_printf(" ALG: ImgEnc: XDM_GETBUFINFO: min in bufs:%ld buf(0):%ld buf(1):%ld\n",pObj->encStatus.bufInfo.minNumInBufs,pObj->encStatus.bufInfo.minInBufSize[0], pObj->encStatus.bufInfo.minInBufSize[1]);
  #endif

  return OSA_SOK;
}
Ejemplo n.º 5
0
Archivo: avServer.c Proyecto: 119/ipnc
int AVSERVER_bufGetCurTskInfo(int tskId, int streamId, OSA_BufHndl **pBufHndl)
{
  VIDEO_CaptureStream *pCaptureStream=NULL;
  VIDEO_EncodeStream  *pEncodeStream=NULL;

  *pBufHndl=NULL;

  if(streamId<0 || streamId >= AVSERVER_MAX_STREAMS) {
    OSA_ERROR("Incorrect streamId (%d)\n", streamId);
    return OSA_EFAIL;
  }

  if(tskId <= VIDEO_TSK_CAPTURE || tskId > VIDEO_TSK_STREAM) {
    OSA_ERROR("Incorrect tskId (%d)\n", tskId);
    return OSA_EFAIL;
  }

  if(tskId <= VIDEO_TSK_ENCODE) {
    pCaptureStream = &gVIDEO_ctrl.captureStream[streamId];

    if(tskId==VIDEO_TSK_LDC) {
      *pBufHndl = &pCaptureStream->bufLdcIn;
    } else
    if(tskId==VIDEO_TSK_VNF) {
      *pBufHndl = &pCaptureStream->bufVnfIn;
    } else
    if(tskId==VIDEO_TSK_RESIZE) {
      *pBufHndl = &pCaptureStream->bufResizeIn;
    } else
    if(tskId==VIDEO_TSK_ENCODE) {
      *pBufHndl = &pCaptureStream->bufEncodeIn;
    } else {
      OSA_ERROR("Incorrect tskId (%d)\n", tskId);
      return OSA_EFAIL;
    }

  } else {

    pEncodeStream  = &gVIDEO_ctrl.encodeStream[streamId];

    if(tskId==VIDEO_TSK_ENCRYPT) {
      *pBufHndl = &pEncodeStream->bufEncryptIn;
    } else
    if(tskId==VIDEO_TSK_STREAM) {
      *pBufHndl = &pEncodeStream->bufStreamIn;
    } else {
      OSA_ERROR("Incorrect tskId (%d)\n", tskId);
      return OSA_EFAIL;
    }
  }

  return OSA_SOK;
}
Ejemplo n.º 6
0
int AdjustApertureLevel(Uint8 level)
{
#define IRIS_I2C_ADDR     (0x0898U)
    DRV_I2cHndl i2cHnd2;
    int status = OSA_EFAIL;
    Uint16 regAddr16=0;
    Uint16 regValue = 0;

    level = (level >= 100) ? 100 : level;

    Uint8 da_value = 255 * (100 - level) / 100;
    static Uint8 da_value_bak = 50;

    if (da_value == da_value_bak)
    {
        return OSA_SOK;
    }
    da_value_bak = da_value;

    memset(&i2cHnd2, 0, sizeof(i2cHnd2));
    status = DRV_i2cOpen(&i2cHnd2, IRIS_I2C_ADDR);

    if (status == OSA_SOK)
    {
        regValue = (Uint16)da_value << 4;//Please refer to the manual DAC5571
        status = DRV_i2c16Write16(&i2cHnd2, &regAddr16, &regValue, 1);

        if (status != OSA_SOK)
        {
            OSA_ERROR("AdjustApertureLevel error!\n");
        }
        else
        {
            OSA_printf("AdjustApertureLevel level= %d\n", level);
        }
    }

    DRV_i2cClose(&i2cHnd2);
    if (status != OSA_SOK)
    {
        OSA_ERROR("DRV_i2cClose() error!\n");
        return OSA_EFAIL;
    }

    OSA_waitMsecs(10);

    return OSA_SOK;
}
Ejemplo n.º 7
0
int TVP5158_softReset(DRV_I2cHndl *i2cHndl)
  {
  	int status=OSA_SOK;
	Uint8 regAddr[64];
	Uint8 regVal[64];
  Uint32 k;
  Uint8 vbusStatus;  

    status = TVP5158_selectWrite(i2cHndl, 0xF);
  if(status!=OSA_SOK)
    goto error_exit;

  k=0;

  vbusStatus = 0x1;

  status = TVP5158_vbusWrite(i2cHndl, 0xB00060, vbusStatus, 1);
  if(status!=OSA_SOK)
    goto error_exit;

  vbusStatus = 0x0;

  status = TVP5158_vbusWrite(i2cHndl, 0xB00060, vbusStatus, 1);
  if(status!=OSA_SOK)
    goto error_exit;

  OSA_waitMsecs(300);
  
error_exit:
  if(status!=OSA_SOK)
    OSA_ERROR("I2C");

  return status;  
}
Ejemplo n.º 8
0
int OSA_msgqCreate(OSA_MsgqHndl *hndl)
{
  pthread_mutexattr_t mutex_attr;
  pthread_condattr_t cond_attr;
  int status=OSA_SOK;
 
  status |= pthread_mutexattr_init(&mutex_attr);
  status |= pthread_condattr_init(&cond_attr);  
  
  status |= pthread_mutex_init(&hndl->lock, &mutex_attr);
  status |= pthread_cond_init(&hndl->condRd, &cond_attr);    
  status |= pthread_cond_init(&hndl->condWr, &cond_attr);  

  hndl->curRd = hndl->curWr = 0;
  hndl->count = 0;
  hndl->len   = OSA_MSGQ_LEN_MAX;

  if(status!=OSA_SOK)
    OSA_ERROR("OSA_msgqCreate() = %d \r\n", status);
    
  pthread_condattr_destroy(&cond_attr);
  pthread_mutexattr_destroy(&mutex_attr);
    
  return status;
}
Ejemplo n.º 9
0
int DRV_faceDetectOpen()
{
  memset(&gDRV_faceDetectObj, 0, sizeof(gDRV_faceDetectObj));
  
  gDRV_faceDetectObj.workAreaVirtAddr = OSA_cmemAlloc(DRV_FACE_DETECT_WORK_AREA_SIZE, 32);
  gDRV_faceDetectObj.workAreaPhysAddr = OSA_cmemGetPhysAddr(gDRV_faceDetectObj.workAreaVirtAddr);
    
  if(  gDRV_faceDetectObj.workAreaVirtAddr==NULL
   ||  gDRV_faceDetectObj.workAreaPhysAddr==NULL
    ) {
    OSA_ERROR("Insufficient memory\n");
    goto error_exit;
  }
  
  CSL_faceDetectIntClear(&gCSL_faceDetectHndl);  
  CSL_faceDetectIntEnable(&gCSL_faceDetectHndl, TRUE);
  
  return OSA_SOK;
  
error_exit:
  if(gDRV_faceDetectObj.workAreaVirtAddr)
    OSA_cmemFree(gDRV_faceDetectObj.workAreaVirtAddr);

  return OSA_EFAIL;  
}
Ejemplo n.º 10
0
Archivo: drv_isif.c Proyecto: 119/ipnc
int DRV_isifGetBayerPhase(int sensorMode)
{
	DRV_ImgsIsifConfig  *isifConfig;
	CSL_CcdcColPatConfig *colPat;

	isifConfig= DRV_imgsGetIsifConfig(sensorMode);
	colPat= &isifConfig->ccdcParams.colPat;

	switch(colPat->colPat0[0][0])
	{
		case CSL_CCDC_COL_PAT_Gr:
			return 0;
			break;
		case CSL_CCDC_COL_PAT_R:
			return 1;
			break;
		case CSL_CCDC_COL_PAT_Gb:
			return 2;
			break;
		case CSL_CCDC_COL_PAT_B:
			return 3;
			break;
		default:
			OSA_ERROR("Undefined Bayer format\n");
			return 0;
			break;
	}
}
Ejemplo n.º 11
0
Archivo: osa_sem.c Proyecto: 119/ipnc
int OSA_semCreate(OSA_SemHndl *hndl, Uint32 maxCount, Uint32 initVal)
{
  pthread_mutexattr_t mutex_attr;
  pthread_condattr_t cond_attr;
  int status=OSA_SOK;
 
  status |= pthread_mutexattr_init(&mutex_attr);
  status |= pthread_condattr_init(&cond_attr);  
  
  status |= pthread_mutex_init(&hndl->lock, &mutex_attr);
  status |= pthread_cond_init(&hndl->cond, &cond_attr);  

  hndl->count = initVal;
  hndl->maxCount = maxCount;

  if(hndl->maxCount==0)  
    hndl->maxCount=1;
    
  if(hndl->count>hndl->maxCount)
    hndl->count = hndl->maxCount;

  if(status!=OSA_SOK)
    OSA_ERROR("OSA_semCreate() = %d \r\n", status);
    
  pthread_condattr_destroy(&cond_attr);
  pthread_mutexattr_destroy(&mutex_attr);
  
  return status;
}
Ejemplo n.º 12
0
int TVP5158_setNoiseReduction(DRV_I2cHndl *i2cHndl, int enable, int channel)
{
	int status=OSA_SOK;
	Uint8 regAddr[2];
	Uint8 regVal[2];
	Uint32 k;
	Uint8 chVal=1;	

	chVal = chVal << channel;

	status = TVP5158_selectWrite(i2cHndl, chVal);

	if(status!=OSA_SOK)
    	goto error_exit;  
    
	k=0;	
	regAddr[k] = 0x5D;
	regVal[k]  = (Uint8)enable;
	k++;

  OSA_printf(" TVP5158: NoiseReduction [Ch=%d value=%x]\n", chVal, enable);

 	status = DRV_i2cWrite8(i2cHndl, regAddr, regVal, k);
 	if(status!=OSA_SOK)
   	goto error_exit;	

	OSA_waitMsecs(20); 

error_exit:
 	if(status!=OSA_SOK)
   	OSA_ERROR("I2C-NoiseReduction");	

 	return status;
}
Ejemplo n.º 13
0
int TVP5158_setStdStatus(DRV_I2cHndl *i2cHndl)
{
	int status;
	Uint8 regAddr[2];
	Uint8 regVal[2];
  Uint32 k;
  
  status = TVP5158_selectWrite(i2cHndl, 0xF);
  if(status!=OSA_SOK)
    goto error_exit;	
    
	k=0;
	regAddr[k] = 0xD;
	regVal[k] = 0x01;
	k++;
	    
  status = DRV_i2cWrite8(i2cHndl, regAddr, regVal, k);
  if(status!=OSA_SOK)
    goto error_exit;
    	    
error_exit:
  if(status!=OSA_SOK)
    OSA_ERROR("I2C");

  return status;    
}
Ejemplo n.º 14
0
int TVP5158_setHybridChSelect(DRV_I2cHndl *i2cHndl, int channel)
{
	int status=OSA_SOK;
	Uint8 regAddr[64];
	Uint8 regVal[64];
	Uint32 k;
	
	status = TVP5158_selectWrite(i2cHndl, 0xF);
	if(status!=OSA_SOK)
		goto error_exit;  	
		
	k=0;
	
	regAddr[k] = 0xB5;
	regVal[k]  = (Uint8)channel;
	k++;			
	
	#ifdef TVP5158_DEBUG
	OSA_printf(" TVP5158: HybridChannel [Ch=%d]\n", channel);
	#endif

	status = DRV_i2cWrite8(i2cHndl, regAddr, regVal, k);
	if(status!=OSA_SOK)
		goto error_exit;  
    
	OSA_waitMsecs(20); 

error_exit:
	if(status!=OSA_SOK)
		OSA_ERROR("I2C-HybirdChannel");

	return status;    		
}
Ejemplo n.º 15
0
int DRV_captureTestLscRun(int count)
{
  int status;
  int bufId;  
  OSA_BufInfo *pBufInfo;
  
  status = DRV_isifLscGetBuf(&bufId, OSA_TIMEOUT_FOREVER);
  if(status!=OSA_SOK) {
    OSA_ERROR("DRV_isifLscGetBuf()\n");
    return status;
  }
  
  pBufInfo =   DRV_isifLscGetBufInfo(bufId);  
  if(pBufInfo) {
  
    #ifdef DRV_CAPTURE_TEST_SAVE_LSC_DATA
    if(count>1) {
      static char filename[80];    
      
      if(count%(30*10)==0) {
        sprintf(filename, "LSC_%04d_%dx%d.BIN", count, gDRV_testCtrl.captureInfo.isifInfo.lscDataOffsetH, gDRV_testCtrl.captureInfo.isifInfo.lscDataHeight);
        OSA_fileWriteFile(filename, pBufInfo->virtAddr, pBufInfo->size);      
      }
    }
    #endif  
    
    if(count%(30*5)==0) {        

    }
  }
  
  DRV_isifLscPutBuf(bufId);
  
  return status;  
}
Ejemplo n.º 16
0
int DRV_imgsTestMain(int argc, char **argv)
{
    DRV_ImgsConfig imgsConfig;

    int status = DRV_init();
    if (status != OSA_SOK)
    {
        return status;
    }

    imgsConfig.sensorMode = DRV_IMGS_SENSOR_MODE_640x480;
    imgsConfig.fps        = 30;
    imgsConfig.binEnable  = TRUE;

    OSA_printf(" IMGS: Imager %s is selected\n", drvImgsFunc->imgsGetImagerName());

    status = drvImgsFunc->imgsOpen(&imgsConfig);
    if (status != OSA_SOK)
    {
        OSA_ERROR("DRV_imgsOpen(%d)\n", imgsConfig.sensorMode);
    }

    if (status == OSA_SOK)
    {
        drvImgsFunc->imgsEnable(TRUE);
        OSA_DEBUG_WAIT;
        drvImgsFunc->imgsEnable(FALSE);
        drvImgsFunc->imgsClose();
    }

    DRV_exit();

    return status;
}
Ejemplo n.º 17
0
//static int g_create_i = 0;
int OSA_thrCreate(OSA_ThrHndl *hndl, OSA_ThrEntryFunc entryFunc, Uint32 pri, Uint32 stackSize, void *prm)
{
  int status=OSA_SOK;
  pthread_attr_t thread_attr;
  struct sched_param schedprm;

  // initialize thread attributes structure
  status = pthread_attr_init(&thread_attr);
  
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_thrCreate() - Could not initialize thread attributes\n");
    return status;
  }
  
  if(stackSize!=OSA_THR_STACK_SIZE_DEFAULT)
    pthread_attr_setstacksize(&thread_attr, stackSize);

  status |= pthread_attr_setinheritsched(&thread_attr, PTHREAD_EXPLICIT_SCHED);
  status |= pthread_attr_setschedpolicy(&thread_attr, SCHED_FIFO);
    
  if(pri>OSA_THR_PRI_MAX)   
    pri=OSA_THR_PRI_MAX;
  else 
  if(pri<OSA_THR_PRI_MIN)   
    pri=OSA_THR_PRI_MIN;
    
  schedprm.sched_priority = pri;
  status |= pthread_attr_setschedparam(&thread_attr, &schedprm);

  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_thrCreate() - Could not initialize thread attributes\n");
    goto error_exit;
  }

  status = pthread_create(&hndl->hndl, &thread_attr, entryFunc, prm);

  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_thrCreate() - Could not create thread [%d]\n", status);
  }

//  printf("OSA_thrcreate %d thr ,and hndl = %d==func=%p\n",g_create_i++,hndl->hndl,entryFunc);
	
error_exit:  
  pthread_attr_destroy(&thread_attr);

  return status;
}
Ejemplo n.º 18
0
Archivo: drv_regrw.c Proyecto: 119/ipnc
int DRV_regTestMain(int argc, char **argv)
{
  int status;
  Uint32 regAddr;
  Uint32 regValue;
  Uint32 numRegs=8;
  Uint32 numCols=0;
  Bool   regDump;
  
  if(argc<2) {
    DRV_regTestShowUsage(argv[0]);
    return OSA_EFAIL;  
  }
  
  if(strcmp(argv[1], "-w")==0) {
    regDump=FALSE;
    if(argc < 4) {
      DRV_regTestShowUsage(argv[0]);
      return OSA_EFAIL;  
    }
    regAddr = xstrtoi(argv[2]);
    regValue = xstrtoi(argv[3]);      
  }
  else {
    regDump=TRUE;  

    if(argc<2) {
      DRV_regTestShowUsage(argv[0]);
      return OSA_EFAIL;  
    }
    
    regAddr = xstrtoi(argv[1]);
    if(argc>2) 
      numRegs = atoi(argv[2]);
    
    if(argc==5) {
      if(strcmp(argv[3], "-c")==0) 
        numCols = atoi(argv[4]);
    }
  
  }

  status = CSL_vpssOpen(&gCSL_vpssHndl);
  if(status!=OSA_SOK) {
    OSA_ERROR("CSL_sysInit()\n");
    return status;
  }

  if(regDump) {
    DRV_regDump(regAddr, numRegs, numCols);
  } else {
    DRV_regWrite(regAddr, regValue);
  }

  status = CSL_vpssClose(&gCSL_vpssHndl);
  
  return status;
}
Ejemplo n.º 19
0
int VIDEO_fdCreate()
{
  int status;

  status = OSA_mutexCreate(&gVIDEO_ctrl.faceDetectStream.statusLock);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_mutexCreate()\n");
    return status;
  }

  status = OSA_tskCreate( &gVIDEO_ctrl.fdTsk, VIDEO_fdTskMain, VIDEO_FD_THR_PRI, VIDEO_FD_STACK_SIZE, 0);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_tskCreate()\n");
    return status;
  }

  return status;
}
Ejemplo n.º 20
0
Archivo: avServer.c Proyecto: 119/ipnc
OSA_BufInfo *AVSERVER_bufPutEmpty(int tskId, int streamId, int bufId)
{
  OSA_BufHndl *pBufHndl;
  int status;

  status = AVSERVER_bufGetCurTskInfo(tskId, streamId, &pBufHndl);
  if(status!=OSA_SOK) {
    OSA_ERROR("AVSERVER_bufGetCurTskInfo(%d, %d)\n", tskId, streamId);
    return NULL;
  }

  status = OSA_bufPutEmpty(pBufHndl, bufId);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_bufPutEmpty(%d, %d, %d)\n", tskId, streamId, bufId);
    return NULL;
  }

  return OSA_bufGetBufInfo(pBufHndl, bufId);
}
Ejemplo n.º 21
0
int DRV_frameCopyInit()
{
  int status;
  
  status = OSA_mutexCreate(&gDRV_frameCopyObj.lock);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_mutexCreate()\n");
    return OSA_SOK;
  }
  
  status = DRV_dmaOpen(&gDRV_frameCopyObj.dmaHndl, DRV_DMA_MODE_NORMAL, 2);
  if(status!=OSA_SOK) {
    OSA_ERROR("DRV_dmaOpen()\n");  
    OSA_mutexDelete(&gDRV_frameCopyObj.lock);
    return status;
  }

  return status;
}
Ejemplo n.º 22
0
int VIDEO_vnfCreate()
{
  int status;

  status = OSA_tskCreate( &gVIDEO_ctrl.vnfTsk, VIDEO_vnfTskMain, VIDEO_VNF_THR_PRI, VIDEO_VNF_STACK_SIZE, 0);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_tskCreate()\n");
    return status;
  }

  return status;
}
Ejemplo n.º 23
0
int OSA_mbxCreate(OSA_MbxHndl *pMbxHndl)
{
  int status=OSA_SOK;
  
  status |= OSA_msgqCreate(&pMbxHndl->rcvMbx);
  status |= OSA_msgqCreate(&pMbxHndl->ackMbx);

  if(status!=OSA_SOK)
    OSA_ERROR("OSA_mbxCreate() = %d \r\n", status);

  return status;
}
Ejemplo n.º 24
0
int VIDEO_encryptTskRun(int streamId)
{
  int status=OSA_EFAIL, inBufId, outBufId;
  OSA_BufInfo *pInBufInfo, *pOutBufInfo;
  VIDEO_BufHeader *pInBufHeader, *pOutBufHeader;
  
  pInBufInfo = AVSERVER_bufGetFull( VIDEO_TSK_ENCRYPT, streamId, &inBufId, OSA_TIMEOUT_FOREVER);
  
  OSA_assert(pInBufInfo!=NULL);
  
  if(pInBufInfo!=NULL) {
  
    pOutBufInfo = AVSERVER_bufGetEmpty( VIDEO_TSK_ENCRYPT, streamId, &outBufId, OSA_TIMEOUT_FOREVER);  
    
    OSA_assert(pOutBufInfo!=NULL);    

    #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
      #ifdef AVSERVER_DEBUG_RUNNING
      OSA_printf(" ENCRYPT: Stream %d InBuf %d OutBuf %d\n", streamId, inBufId, outBufId);
      #endif
    #endif
  
    if(pOutBufInfo!=NULL) {
  
      pInBufHeader  = (VIDEO_BufHeader*)pInBufInfo->virtAddr;
      pOutBufHeader = (VIDEO_BufHeader*)pOutBufInfo->virtAddr;
      
      OSA_assert(pInBufHeader!=NULL);
      OSA_assert(pOutBufHeader!=NULL);                          

      if(pInBufHeader->encFrameSize > 0) {
      
        status = ALG_encryptRun(gVIDEO_ctrl.encodeStream[streamId].algEncryptHndl, 
                                pInBufInfo->virtAddr, 
                                pOutBufInfo->virtAddr,
                                pInBufHeader->encFrameSize
                              );
        if(status!=OSA_SOK) {
          OSA_ERROR("ALG_encryptRun(%d)\n", streamId);
          pOutBufHeader->encFrameSize = 0;          
        }
      }      

      memcpy(pOutBufHeader, pInBufHeader, sizeof(*pOutBufHeader));
      
      AVSERVER_bufPutFull( VIDEO_TSK_ENCRYPT, streamId, outBufId);          
    }

    AVSERVER_bufPutEmpty( VIDEO_TSK_ENCRYPT, streamId, inBufId);  
  }
  
  return status;
}
Ejemplo n.º 25
0
int VIDEO_displayCreate()
{
  int status;

  status = OSA_tskCreate( &gVIDEO_ctrl.displayTsk, VIDEO_displayTskMain, VIDEO_DISPLAY_THR_PRI, VIDEO_DISPLAY_STACK_SIZE, 0);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_tskCreate()\n");
    return status;
  }

  return status;
}
Ejemplo n.º 26
0
int VIDEO_encryptCreate()
{
  int status;
  
  status = OSA_tskCreate( &gVIDEO_ctrl.encryptTsk, VIDEO_encryptTskMain, VIDEO_ENCRYPT_THR_PRI, VIDEO_ENCRYPT_STACK_SIZE, 0);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_tskCreate()\n");
    return status;
  }
  
  return status;
}
Ejemplo n.º 27
0
int ALG_jpgDecSetDynamicParams(ALG_JpgDecObj *pObj, Bool decodeHeader, Uint16 offsetH)
{
  XDAS_Int32 status;

  pObj->dynamicParams.size   = sizeof(pObj->dynamicParams);
  pObj->dynamicParams.numAU  = XDM_DEFAULT;

  if(decodeHeader)
    pObj->dynamicParams.decodeHeader = XDM_PARSE_HEADER;
  else
    pObj->dynamicParams.decodeHeader = XDM_DECODE_AU;

  pObj->dynamicParams.displayWidth = offsetH;

  /* Set video decoder dynamic parameters */
  pObj->decStatus.size = sizeof(pObj->decStatus);
  pObj->decStatus.data.buf = NULL;

  status = IMGDEC1_control(pObj->hDecode, XDM_SETPARAMS, &pObj->dynamicParams, &pObj->decStatus);

  if (status != IMGDEC1_EOK) {
    OSA_ERROR("XDM_SETPARAMS failed, status=%ld\n", status);
    return OSA_EFAIL;
  }

  pObj->decStatus.data.buf = NULL;

  status = IMGDEC1_control(pObj->hDecode, XDM_GETBUFINFO, &pObj->dynamicParams, &pObj->decStatus);

  if (status != IMGDEC1_EOK) {
      OSA_ERROR("XDM_GETBUFINFO failed, status=%ld\n", status);
      return OSA_EFAIL;
  }

  #ifdef ALG_DEBUG
  OSA_printf(" ALG: ImgDec: XDM_GETBUFINFO: min in bufs:%ld buf(0):%ld buf(1):%ld\n",pObj->decStatus.bufInfo.minNumInBufs,pObj->decStatus.bufInfo.minInBufSize[0], pObj->decStatus.bufInfo.minInBufSize[1]);
  #endif

  return OSA_SOK;
}
Ejemplo n.º 28
0
Archivo: osa.c Proyecto: 119/ipnc
int OSA_init()
{
  int status;
  
  status = OSA_mutexCreate(&gOSA_printfLock);
  if(status!=OSA_SOK)
    OSA_ERROR("OSA_mutexCreate()\n");
    
  #if 0    
  OSA_printf(" OSA: THR_PRI = %d .. %d\n", OSA_THR_PRI_MIN, OSA_THR_PRI_MAX);  
  #endif
  
  return status;  
}
Ejemplo n.º 29
0
int DRV_faceDetectRun(DRV_FaceDetectRunPrm *prm, DRV_FaceDetectRunStatus *pStatus)
{
  CSL_FaceDetectHwSetup setup;
  int status;
  int retry;
  
  CSL_faceDetectIntClear(&gCSL_faceDetectHndl);  

  setup.inputAddr         = prm->inPhysAddr;
  setup.workAreaAddr      = gDRV_faceDetectObj.workAreaPhysAddr;
  setup.inStartX          = 0;
  setup.inStartY          = 0;
  setup.inWidth           = prm->inWidth;
  setup.inHeight          = prm->inHeight;
  setup.detectThres       = prm->detectThres;
  setup.detectCondition   = prm->detectCondition;
    
  status = CSL_faceDetectHwSetup(&gCSL_faceDetectHndl, &setup);
  if(status!=OSA_SOK) {
    OSA_ERROR("CSL_faceDetectHwSetup()\n");
    return status;
  }
 
  CSL_faceDetectIntWait(&gCSL_faceDetectHndl, 200);
  
  retry=50;
  
  #if 0
  while( gCSL_vpssHndl.faceDetectRegs->FD_CTRL != 0x4 ) {
    OSA_waitMsecs(1);
    retry--;
    if(retry==0)
      break;
  }
  #endif
    
  CSL_faceDetectDisable(&gCSL_faceDetectHndl);  
  
  pStatus->numFaces = 0;
  
  if(retry==0) {
    return OSA_EFAIL;
  }
  
  status = CSL_faceDetectGetStatus(&gCSL_faceDetectHndl, pStatus->info, &pStatus->numFaces);
  
  //DRV_faceDetectStabilizeFaceStatus(pStatus);

  return status;
}
Ejemplo n.º 30
0
int VIDEO_displayTskRun(OSA_BufInfo *pBufInfo)
{
  int status, inBufId;
  static int disFrameNum = 0;

#ifdef DISBUF_MEMCPY
  status = OSA_bufGetFull(&gVIDEO_ctrl.displayStream.bufDisplayIn, &inBufId, OSA_TIMEOUT_FOREVER);
  if(status!=OSA_SOK) {
    OSA_ERROR("OSA_bufGetFull()\n");
    return status;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
     #ifdef AVSERVER_DEBUG_RUNNING
     OSA_printf(" DISPLAY: Get Buf %d \n", inBufId);
     #endif
  #endif

  status = DRV_displaySwitchBuf(&gVIDEO_ctrl.displayStream.displayHndl, &inBufId, 0, NULL);
#else
  if(gAVSERVER_config.displayEnable)
  {
      inBufId = (disFrameNum++ % gVIDEO_ctrl.displayStream.bufDisplayInCreatePrm.numBuf);
      status = DRV_displaySwitchBuf(&gVIDEO_ctrl.displayStream.displayHndl, &inBufId, 1, pBufInfo->virtAddr + VIDEO_BUF_HEADER_SIZE);
  }
  else
  {
      inBufId = (disFrameNum++ % gVIDEO_ctrl.displayStream.bufDisplayInCreatePrm.numBuf);
      status = DRV_displaySwitchBuf(&gVIDEO_ctrl.displayStream.displayHndl, &inBufId, 2, NULL);
  }
#endif //#ifdef DISBUF_MEMCPY

  //if(!gAVSERVER_config.displayEnable)
  //	DRV_displayEnable(&gVIDEO_ctrl.displayStream.displayHndl, FALSE);

  if(status==OSA_SOK) {
#ifdef DISBUF_MEMCPY
    OSA_bufPutEmpty(&gVIDEO_ctrl.displayStream.bufDisplayIn, inBufId);

    #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
      #ifdef AVSERVER_DEBUG_RUNNING
      OSA_printf(" DISPLAY: Put Buf %d \n", inBufId);
      #endif
    #endif
#endif // #ifdef DISBUF_MEMCPY
  }

  return status;
}