Beispiel #1
0
int OSA_TEST_PSTB_Main(struct OSA_TskHndl *pPrc, OSA_MsgHndl *pMsg, Uint32 curState )
{
  Uint16 cmd = OSA_msgGetCmd(pMsg);

  OSA_setTskName("osapstb");
  OSA_assert(curState == OSA_TEST_STATE__READY);

  switch(cmd) {
    case OSA_TEST_CMD__INIT:
      OSA_TEST_PSTB_MainRun(pPrc, pMsg, curState);
      break;
    default:
      OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
      break;
  }

  return OSA_SOK;
}
Beispiel #2
0
int OSA_mbxWaitCmd(OSA_MbxHndl *pMbxHndl, OSA_MsgHndl **pMsg, Uint16 waitCmd)
{
  OSA_MsgHndl *pRcvMsg;

  while(1) {
    OSA_mbxWaitMsg(pMbxHndl, &pRcvMsg);
    if(OSA_msgGetCmd(pRcvMsg)==waitCmd)
      break;
    OSA_mbxAckOrFreeMsg(pRcvMsg, OSA_SOK);
  }

  if(pMsg==NULL) {
    OSA_mbxAckOrFreeMsg(pRcvMsg, OSA_SOK);
  } else {
    *pMsg = pRcvMsg;
  }

  return OSA_SOK;
}
Beispiel #3
0
int OSA_TEST_PSTC_MainRun(OSA_TskHndl *pPrc, OSA_MsgHndl *pMsg, Uint32 curState)
{
  int retVal;
  Bool done=FALSE;
  Uint16 cmd;
  Uint32 delay;

  delay = *(Uint32*)OSA_msgGetPrm(pMsg);

  // init
  OSA_waitMsecs(delay);
  OSA_printf("\r\n PST C : INIT DONE ");
  OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

  OSA_tskWaitCmd(pPrc, NULL, OSA_TEST_CMD__START);

  OSA_printf("\r\n PST C : STARTED");
  OSA_tskSetState(pPrc, OSA_TEST_STATE__RUN);

  // run
  while(!done) {

    OSA_waitMsecs(delay);

    if(OSA_tskGetState(pPrc)==OSA_TEST_STATE__RUN) {
      OSA_printf("\r\n PST C : RUNNING ");
    }

    retVal = OSA_tskCheckMsg(pPrc, &pMsg);
    if(retVal!=OSA_SOK)
      continue;

    cmd = OSA_msgGetCmd(pMsg);

    switch(cmd) {
      case OSA_TEST_CMD__STOP:
        done = TRUE;
        break;
      case OSA_TEST_CMD__PAUSE:
        OSA_waitMsecs(delay);
        OSA_printf("\r\n PST C : PAUSED ");
        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        OSA_tskSetState(pPrc, OSA_TEST_STATE__PAUSE);
        break;  
      case OSA_TEST_CMD__RESUME:
        OSA_waitMsecs(delay);
        OSA_printf("\r\n PST C : RESUMED ");
        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        OSA_tskSetState(pPrc, OSA_TEST_STATE__RUN);
        break;  
      default:
        OSA_assert(0);
        break;
    }
  }

  // exit
  OSA_waitMsecs(delay);
  OSA_printf("\r\n PST C : STOPPED");
  OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
  OSA_tskSetState(pPrc, OSA_TEST_STATE__READY);

  return OSA_SOK;
}
Beispiel #4
0
int OSA_TEST_PSEQ_Main(struct OSA_TskHndl *pPrc, OSA_MsgHndl *pMsg, Uint32 curState )
{
  int retVal = OSA_SOK;
  Uint16 cmd = OSA_msgGetCmd(pMsg);

  OSA_setTskName("osapseq");
  
  switch(curState) {
    case OSA_TEST_STATE__READY:
      
      switch(cmd) {
        case OSA_TEST_CMD__START:
          OSA_TEST_PSEQ_Start(pPrc, pMsg, curState);
          OSA_tskAckOrFreeMsg(pMsg, retVal);
          break;
        
        default:
          OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
          break;
      }
      break;

    case OSA_TEST_STATE__RUN:

      switch(cmd) {
        case OSA_TEST_CMD__STOP:
          OSA_TEST_PSEQ_Stop(pPrc, pMsg, curState);
          OSA_tskAckOrFreeMsg(pMsg, retVal);
          break;

        case OSA_TEST_CMD__PAUSE:
          OSA_TEST_PSEQ_Pause(pPrc, pMsg, curState);
          OSA_tskAckOrFreeMsg(pMsg, retVal);
          break;
        
        default:
          OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
          break;
      }
      break;

    case OSA_TEST_STATE__PAUSE:

      switch(cmd) {
        case OSA_TEST_CMD__STOP:
          OSA_TEST_PSEQ_Stop(pPrc, pMsg, curState);
          OSA_tskAckOrFreeMsg(pMsg, retVal);
          break;

        case OSA_TEST_CMD__START:
        case OSA_TEST_CMD__RESUME:
          OSA_TEST_PSEQ_Resume(pPrc, pMsg, curState);
          OSA_tskAckOrFreeMsg(pMsg, retVal);
          break;
        
        default:
          OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
          break;
      }
      break;

    default:
      OSA_assert(0);
      break;
  }

  return retVal;
}
Beispiel #5
0
int VIDEO_encryptTskMain(struct OSA_TskHndl *pTsk, OSA_MsgHndl *pMsg, Uint32 curState )
{
  int status, streamId;
  Bool done=FALSE, ackMsg = FALSE;
  Uint16 cmd = OSA_msgGetCmd(pMsg);

  OSA_setTskName("encrypt");
  
  #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
  OSA_printf(" ENCRYPT: Recevied CMD = 0x%04x\n", cmd);
  #endif  
  
  if(cmd!=AVSERVER_CMD_CREATE) {
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
    return OSA_SOK;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
  OSA_printf(" ENCRYPT: Create...\n");
  #endif  
  
  status = VIDEO_encryptTskCreate();
  
  OSA_tskAckOrFreeMsg(pMsg, status);  
  
  if(status!=OSA_SOK) {
    OSA_ERROR("VIDEO_encryptTskCreate()");
    return status;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
  OSA_printf(" ENCRYPT: Create...DONE\n");
  #endif  
    
  while(!done) {
    
    status = OSA_tskWaitMsg(pTsk, &pMsg);

    if(status!=OSA_SOK) 
      break;

    cmd = OSA_msgGetCmd(pMsg);

    switch(cmd) {
      case AVSERVER_CMD_DELETE:
        done = TRUE;
        ackMsg = TRUE;
        break;

      case AVSERVER_CMD_NEW_DATA:
        streamId = (int)OSA_msgGetPrm(pMsg);
        
        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        
        VIDEO_encryptTskRun(streamId);
        
        break;
      default:

        #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
        OSA_printf(" ENCRYPT: Unknown CMD = 0x%04x\n", cmd);
        #endif  
      
        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);      
        break;
    }
  }
  
  #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
  OSA_printf(" ENCRYPT: Delete...\n");
  #endif  
  
  VIDEO_encryptTskDelete();
  
  if(ackMsg)
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

  #ifdef AVSERVER_DEBUG_VIDEO_ENCRYPT_THR
  OSA_printf(" ENCRYPT: Delete...DONE\n");
  #endif  

  return OSA_SOK;
}
Beispiel #6
0
int VIDEO_vnfTskMain(struct OSA_TskHndl *pTsk, OSA_MsgHndl *pMsg, Uint32 curState )
{
  int status, streamId;
  Bool done=FALSE, ackMsg = FALSE;
  Uint16 cmd = OSA_msgGetCmd(pMsg);
  Int32 sysRegBase;

  #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
  OSA_printf(" VNF: Recevied CMD = 0x%04x\n", cmd);
  #endif

  if(cmd!=AVSERVER_CMD_CREATE) {
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
    return OSA_SOK;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
  OSA_printf(" VNF: Create...\n");
  #endif

  DM365MM_init();
  sysRegBase = DM365MM_mmap(0x01C40000,0x4000);

  status = VIDEO_vnfTskCreate(sysRegBase);

  OSA_tskAckOrFreeMsg(pMsg, status);

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

  #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
  OSA_printf(" VNF: Create...DONE\n");
  #endif

  while(!done) {

    status = OSA_tskWaitMsg(pTsk, &pMsg);

    if(status!=OSA_SOK)
      break;

    cmd = OSA_msgGetCmd(pMsg);

    switch(cmd) {
      case AVSERVER_CMD_DELETE:
        done = TRUE;
        ackMsg = TRUE;
        break;

      case AVSERVER_CMD_NEW_DATA:
        streamId = (int)OSA_msgGetPrm(pMsg);

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

        VIDEO_vnfTskRun(streamId);

        break;
      default:

        #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
        OSA_printf(" VNF: Unknown CMD = 0x%04x\n", cmd);
        #endif

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        break;
    }
  }

  #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
  OSA_printf(" VNF: Delete...\n");
  #endif

  VIDEO_vnfTskDelete();

  DM365MM_ummap(sysRegBase,0x4000);
  DM365MM_exit();
  if(ackMsg)
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

  #ifdef AVSERVER_DEBUG_VIDEO_VNF_THR
  OSA_printf(" VNF: Delete...DONE\n");
  #endif

  return OSA_SOK;
}
Beispiel #7
0
int VIDEO_displayTskMain(struct OSA_TskHndl *pTsk, OSA_MsgHndl *pMsg, Uint32 curState )
{
  int status;
  Bool done=FALSE, ackMsg = FALSE;
  Uint16 cmd = OSA_msgGetCmd(pMsg);

  OSA_setTskName("display");
  
  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
  OSA_printf(" DISPLAY: Recevied CMD = 0x%04x\n", cmd);
  #endif

  if(cmd!=AVSERVER_CMD_CREATE) {
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
    return OSA_SOK;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
  OSA_printf(" DISPLAY: Create...\n");
  #endif

  status = VIDEO_displayTskCreate();

  OSA_tskAckOrFreeMsg(pMsg, status);

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

  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
  OSA_printf(" DISPLAY: Create...DONE\n");
  #endif

  while(!done) {

    status = OSA_tskWaitMsg(pTsk, &pMsg);

    if(status!=OSA_SOK)
      break;

    cmd = OSA_msgGetCmd(pMsg);

    switch(cmd) {
      case AVSERVER_CMD_DELETE:
        done = TRUE;
        ackMsg = TRUE;
        break;

      case AVSERVER_CMD_NEW_DATA:

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

#ifdef DISBUF_MEMCPY
        VIDEO_displayTskRun(NULL);
#else
        VIDEO_displayTskRun((OSA_BufInfo*)OSA_msgGetPrm(pMsg));
#endif

        break;
      default:

        #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
        OSA_printf(" DISPLAY: Unknown CMD = 0x%04x\n", cmd);
        #endif

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        break;
    }
  }

  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
  OSA_printf(" DISPLAY: Delete...\n");
  #endif

  VIDEO_displayTskDelete();

  if(ackMsg)
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

  #ifdef AVSERVER_DEBUG_VIDEO_DISPLAY_THR
  OSA_printf(" DISPLAY: Delete...DONE\n");
  #endif

  return OSA_SOK;
}
Beispiel #8
0
int VIDEO_fdTskMain(struct OSA_TskHndl *pTsk, OSA_MsgHndl *pMsg, Uint32 curState )
{
  int status;
  Bool done=FALSE, ackMsg = FALSE;
  ALG_FaceOpenPrm faceOpenPrm;
  Uint16 cmd = OSA_msgGetCmd(pMsg);

  #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
  OSA_printf(" FD: Received CMD = 0x%04x\n", cmd);
  #endif

  if(cmd!=AVSERVER_CMD_CREATE) {
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
    return OSA_SOK;
  }

  #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
  OSA_printf(" FD: Create...\n");
  #endif

  status = DRV_faceDetectOpen();

  /* Set default path for Face album */
  strcpy(faceOpenPrm.AlbumPath, FR_ALBUM_NAND_PATH);
  status =  ALG_facialFeatureGetMem();
  status = ALG_facialFeatureOpen(&faceOpenPrm);

  status = ALG_faceTrackerOpen();

  OSA_tskAckOrFreeMsg(pMsg, status);

  if(status!=OSA_SOK)
    return OSA_SOK;

  #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
  OSA_printf(" FD: Create...DONE\n");
  #endif

  while(!done) {

    status = OSA_tskWaitMsg(pTsk, &pMsg);

    if(status!=OSA_SOK)
      break;

    cmd = OSA_msgGetCmd(pMsg);

    switch(cmd) {
      case AVSERVER_CMD_DELETE:
        done = TRUE;
        ackMsg = TRUE;
        break;

      case AVSERVER_CMD_NEW_DATA:

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

        VIDEO_fdTskRun();

        break;
      default:

        #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
        OSA_printf(" FD: Unknown CMD = 0x%04x\n", cmd);
        #endif

        OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
        break;
    }
  }

  #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
  OSA_printf(" FD: Delete...\n");
  #endif

  status = DRV_faceDetectClose();

  status = ALG_facialFeatureClose();
  status = ALG_facialFeatureRelMem();

  ALG_faceTrackerClose();

  if(ackMsg)
    OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);

  #ifdef AVSERVER_DEBUG_VIDEO_FD_THR
  OSA_printf(" FD: Delete...DONE\n");
  #endif

  if(gVIDEO_ctrl.faceDetectStream.fdError) {
    OSA_printf(" FD: FD timeout happened while running !!!\n");
  }

  return OSA_SOK;
}