这篇教程C++ DEBUG_PRINT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DEBUG_PRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUG_PRINT函数的具体用法?C++ DEBUG_PRINT怎么用?C++ DEBUG_PRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DEBUG_PRINT函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main( int argc, char *argv[] ){ int fd = 0; int opt, opt_index; int result = -1; long bufSize = 0; // long writtenSize; int writtenSize = 0; long writtenSize_long = 0; char *bufTop = NULL; CNCL_P_SETTINGS Settings; char jobID[CN_START_JOBID_LEN]; char libPathBuf[CN_LIB_PATH_LEN]; void *libclss = NULL; struct option long_opt[] = { { "version", required_argument, NULL, OPT_VERSION }, { "filterpath", required_argument, NULL, OPT_FILTERPATH }, { "papersize", required_argument, NULL, OPT_PAPERSIZE }, { "mediatype", required_argument, NULL, OPT_MEDIATYPE }, { "grayscale", required_argument, NULL, OPT_COLORMODE }, { "duplexprint", required_argument, NULL, OPT_DUPLEXPRINT }, { "jobid", required_argument, NULL, OPT_JOBID }, { "uuid", required_argument, NULL, OPT_UUID }, { 0, 0, 0, 0 }, }; const char *p_ppd_name = getenv("PPD"); uint8_t *xmlBuf = NULL; int xmlBufSize; int retSize; char *tmpBuf = NULL; char uuid[UUID_LEN + 1]; DEBUG_PRINT( "[tocanonij] start tocanonij/n" ); /* init CNCL API */ GETSETCONFIGURATIONCOMMAND = NULL; GETSENDDATAPWGRASTERCOMMAND = NULL; GETPRINTCOMMAND = NULL; GETSTRINGWITHTAGFROMFILE = NULL; GETSETPAGECONFIGUARTIONCOMMAND = NULL; MAKEBJLSETTIMEJOB = NULL; GetProtocol = NULL; ParseCapabilityResponsePrint_HostEnv=NULL; MakeCommand_StartJob3 = NULL; ParseCapabilityResponsePrint_DateTime = NULL; MakeCommand_SetJobConfiguration = NULL; /* Init Settings */ memset( &Settings, 0x00, sizeof(CNCL_P_SETTINGS) ); InitpSettings( &Settings ); memset( uuid, '/0', sizeof(uuid) ); while( (opt = getopt_long( argc, argv, "0:", long_opt, &opt_index )) != -1) { switch( opt ) { case OPT_VERSION: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); break; case OPT_FILTERPATH: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); snprintf( libPathBuf, CN_LIB_PATH_LEN, "%s%s", optarg, CN_CNCL_LIBNAME ); break; case OPT_PAPERSIZE: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); Settings.papersize = ConvertStrToID( optarg, papersizeTbl ); if ( IsBorderless( optarg ) ){ Settings.borderlessprint = CNCL_PSET_BORDERLESS_ON; } else { Settings.borderlessprint = CNCL_PSET_BORDERLESS_OFF; } break; case OPT_MEDIATYPE: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); Settings.mediatype = ConvertStrToID( optarg, mediatypeTbl ); DEBUG_PRINT2( "[tocanonij] media : %d/n", Settings.mediatype ); break;#if 0 case OPT_BORDERLESSPRINT: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); if ( IsBorderless( optarg ) ){ Settings.borderlessprint = CNCL_PSET_BORDERLESS_ON; } else { Settings.borderlessprint = CNCL_PSET_BORDERLESS_OFF; } break;#endif case OPT_COLORMODE: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); Settings.colormode = ConvertStrToID( optarg, colormodeTbl ); break; case OPT_DUPLEXPRINT: DEBUG_PRINT3( "[tocanonij] OPTION(%s):VALUE(%s)/n", long_opt[opt_index].name, optarg ); //Settings.duplexprint = CNCL_PSET_DUPLEX_OFF; Settings.duplexprint = ConvertStrToID( optarg, duplexprintTbl); break; case OPT_UUID://.........这里部分代码省略.........
开发者ID:dbnicholson,项目名称:cnijfilter2,代码行数:101,
示例2: dprintf_oterr//.........这里部分代码省略......... PRINT_CASE(kOTResAddressErr); PRINT_CASE(kOTQFullErr); PRINT_CASE(kOTProtocolErr); PRINT_CASE(kOTBadSyncErr); PRINT_CASE(kOTCanceledErr); PRINT_CASE(kEPERMErr); // PRINT_CASE(kENOENTErr); PRINT_CASE(kENORSRCErr); PRINT_CASE(kEINTRErr); PRINT_CASE(kEIOErr); PRINT_CASE(kENXIOErr); PRINT_CASE(kEBADFErr); PRINT_CASE(kEAGAINErr); // PRINT_CASE(kENOMEMErr); PRINT_CASE(kEACCESErr); PRINT_CASE(kEFAULTErr); PRINT_CASE(kEBUSYErr); // PRINT_CASE(kEEXISTErr); PRINT_CASE(kENODEVErr); PRINT_CASE(kEINVALErr); PRINT_CASE(kENOTTYErr); PRINT_CASE(kEPIPEErr); PRINT_CASE(kERANGEErr); PRINT_CASE(kEWOULDBLOCKErr); // PRINT_CASE(kEDEADLKErr); PRINT_CASE(kEALREADYErr); PRINT_CASE(kENOTSOCKErr); PRINT_CASE(kEDESTADDRREQErr); PRINT_CASE(kEMSGSIZEErr); PRINT_CASE(kEPROTOTYPEErr); PRINT_CASE(kENOPROTOOPTErr); PRINT_CASE(kEPROTONOSUPPORTErr); PRINT_CASE(kESOCKTNOSUPPORTErr); PRINT_CASE(kEOPNOTSUPPErr); PRINT_CASE(kEADDRINUSEErr); PRINT_CASE(kEADDRNOTAVAILErr); PRINT_CASE(kENETDOWNErr); PRINT_CASE(kENETUNREACHErr); PRINT_CASE(kENETRESETErr); PRINT_CASE(kECONNABORTEDErr); PRINT_CASE(kECONNRESETErr); PRINT_CASE(kENOBUFSErr); PRINT_CASE(kEISCONNErr); PRINT_CASE(kENOTCONNErr); PRINT_CASE(kESHUTDOWNErr); PRINT_CASE(kETOOMANYREFSErr); PRINT_CASE(kETIMEDOUTErr); PRINT_CASE(kECONNREFUSEDErr); PRINT_CASE(kEHOSTDOWNErr); PRINT_CASE(kEHOSTUNREACHErr); PRINT_CASE(kEPROTOErr); PRINT_CASE(kETIMEErr); PRINT_CASE(kENOSRErr); PRINT_CASE(kEBADMSGErr); PRINT_CASE(kECANCELErr); PRINT_CASE(kENOSTRErr); PRINT_CASE(kENODATAErr); PRINT_CASE(kEINPROGRESSErr); PRINT_CASE(kESRCHErr); PRINT_CASE(kENOMSGErr); PRINT_CASE(kOTClientNotInittedErr); PRINT_CASE(kOTPortHasDiedErr); PRINT_CASE(kOTPortWasEjectedErr); PRINT_CASE(kOTBadConfigurationErr); PRINT_CASE(kOTConfigurationChangedErr); PRINT_CASE(kOTUserRequestedErr); PRINT_CASE(kOTPortLostConnection); default: name = "< unknown >"; break; } strcpy(error,name); if (ep) { switch (OTGetEndpointState(ep)) { PRINT_CASE(T_UNINIT); PRINT_CASE(T_UNBND); PRINT_CASE(T_IDLE); PRINT_CASE(T_OUTCON); PRINT_CASE(T_INCON); PRINT_CASE(T_DATAXFER); PRINT_CASE(T_OUTREL); PRINT_CASE(T_INREL); default: name = "< unknown >"; break; } } else name = "<unknown>"; strcpy(state,name); DEBUG_PRINT("EP: %p (state: %s), OTError for %s: %s (%d). File: %s, %d",ep, state, message, error, err, file, line); } }
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:101,
示例3: dprintf_err NMErr dprintf_err( char *message, NMErr err, char *file, NMSInt32 line) { char *name; if (err != -1) { DEBUG_PRINT("error value %d passed to dprintf_sockerr for %s. not checking errno. %s line %d",err,message,file,line); return 0; } switch (errno) { PRINT_CASE(EPERM); PRINT_CASE(ENOENT); PRINT_CASE(ESRCH); PRINT_CASE(EINTR); PRINT_CASE(EIO); PRINT_CASE(ENXIO); PRINT_CASE(E2BIG); PRINT_CASE(ENOEXEC); PRINT_CASE(EBADF); PRINT_CASE(ECHILD); PRINT_CASE(EDEADLK); PRINT_CASE(ENOMEM); PRINT_CASE(EACCES); PRINT_CASE(EFAULT); PRINT_CASE(ENOTBLK); PRINT_CASE(EBUSY); PRINT_CASE(EEXIST); PRINT_CASE(EXDEV); PRINT_CASE(ENODEV); PRINT_CASE(ENOTDIR); PRINT_CASE(EISDIR); PRINT_CASE(EINVAL); PRINT_CASE(ENFILE); PRINT_CASE(EMFILE); PRINT_CASE(ENOTTY); PRINT_CASE(ETXTBSY); PRINT_CASE(EFBIG); PRINT_CASE(ENOSPC); PRINT_CASE(ESPIPE); PRINT_CASE(EROFS); PRINT_CASE(EMLINK); PRINT_CASE(EPIPE); PRINT_CASE(EDOM); PRINT_CASE(ERANGE); PRINT_CASE(EWOULDBLOCK); PRINT_CASE(EINPROGRESS); PRINT_CASE(EALREADY); PRINT_CASE(ENOTSOCK); PRINT_CASE(EDESTADDRREQ); PRINT_CASE(EMSGSIZE); PRINT_CASE(EPROTOTYPE); PRINT_CASE(ENOPROTOOPT); PRINT_CASE(EPROTONOSUPPORT); PRINT_CASE(ESOCKTNOSUPPORT); PRINT_CASE(ENOTSUP); PRINT_CASE(EPFNOSUPPORT); PRINT_CASE(EAFNOSUPPORT); PRINT_CASE(EADDRINUSE); PRINT_CASE(EADDRNOTAVAIL); PRINT_CASE(ENETDOWN); PRINT_CASE(ENETUNREACH); PRINT_CASE(ENETRESET); PRINT_CASE(ECONNABORTED); PRINT_CASE(ECONNRESET); PRINT_CASE(ENOBUFS); PRINT_CASE(EISCONN); PRINT_CASE(ENOTCONN); PRINT_CASE(ESHUTDOWN); PRINT_CASE(ETOOMANYREFS); PRINT_CASE(ETIMEDOUT); PRINT_CASE(ECONNREFUSED); PRINT_CASE(ELOOP); PRINT_CASE(ENAMETOOLONG); PRINT_CASE(EHOSTDOWN); PRINT_CASE(EHOSTUNREACH); PRINT_CASE(ENOTEMPTY); PRINT_CASE(EUSERS); PRINT_CASE(EDQUOT); PRINT_CASE(ESTALE); PRINT_CASE(EREMOTE); PRINT_CASE(ENOLCK); PRINT_CASE(ENOSYS); PRINT_CASE(EOVERFLOW);#if (OP_PLATFORM_MAC_MACHO) PRINT_CASE(EPROCLIM); PRINT_CASE(EBADRPC); PRINT_CASE(ERPCMISMATCH); PRINT_CASE(EPROGUNAVAIL); PRINT_CASE(EFTYPE); PRINT_CASE(ENEEDAUTH); PRINT_CASE(EPWROFF); PRINT_CASE(EDEVERR); PRINT_CASE(EBADEXEC);//.........这里部分代码省略.........
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:101,
示例4: __ASSERT_ALWAYS// -----------------------------------------------------------------------------// CExprUDPMsg::TryParsingL// -----------------------------------------------------------------------------//TInt CExprUDPMsg::TryParsingL( TDes8& aData, TInt& aLength ) { __ASSERT_ALWAYS( aData.Left( KUDPPrefix().Length() ) == KUDPPrefix, User::Panic( _L("Protocol"), 1 ) ); // UDP:0123,000e,[Some test data] TInt frameOverhead = KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength + KLengthSuffix().Length() + KDataSuffix().Length() + KMessageSuffix().Length(); if ( aData.Length() >= frameOverhead ) { TPtrC8 portPtr( aData.Mid( KUDPPrefix().Length(), KHexDecimalLength ) ); TLex8 portLexer( portPtr ); TUint port; if ( portLexer.Val( port, EHex ) != KErrNone ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, port = %d" ), port ); //Check port suffix if ( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength, KPortSuffix().Length() ) != KPortSuffix ) { return KErrCorrupt; } TPtrC8 lengthPtr( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length(), KHexDecimalLength ) ); TLex8 lengthLexer( lengthPtr ); TUint length; if ( lengthLexer.Val( length, EHex ) != KErrNone ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, length = %d" ), length ); //Check length suffix if ( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength, KLengthSuffix().Length() ) != KLengthSuffix ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, parsing data" ), length ); if ( aData.Length() >= TInt( frameOverhead + length ) ) { TInt messagePos = KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength + KLengthSuffix().Length(); TPtrC8 message( aData.Mid( messagePos, length ) ); if ( aData.Mid( messagePos + length, KDataSuffix().Length() ) != KDataSuffix ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, message OK" ) ); if ( aData.Mid( messagePos + length + KDataSuffix().Length(), KMessageSuffix().Length() ) != KMessageSuffix ) { return KErrCorrupt; } // send parsed results iObserver->FrameParsedL( port, message ); // set the length of the handled message aLength = frameOverhead + length; return KErrNone; } } return KErrNone; }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:94,
示例5: printPMTListvoid printPMTList(void){ PmtTable* psTempPmt; ProgElement* psTempElement; int iDescCounter,iElemStreamIdx; psTempPmt = m_psPmtList; while(psTempPmt) { DEBUG_PRINT("ProgNumber = %d/n",psTempPmt->iProgNumber); DEBUG_PRINT("VersionNumber = %d/n",psTempPmt->iVersionNumber); DEBUG_PRINT("ValidPmt = %d/n",psTempPmt->bValidPmt); DEBUG_PRINT("PcrPid = 0x%04X/n",psTempPmt->iPcrPid); if (psTempPmt->iOuterDescLength > 0) { DEBUG_PRINT("OuterDescLength = %d/n",psTempPmt->iOuterDescLength); DEBUG_PRINT("Outer Private Descriptor:/n"); for (iDescCounter=0; iDescCounter < psTempPmt->iOuterDescLength; iDescCounter++) { DEBUG_PRINT("0x%02X ",psTempPmt->pcOuterDesc[iDescCounter]&0xFF); } } DEBUG_PRINT("/n"); psTempElement = psTempPmt->psElementList; iElemStreamIdx = 0; while (psTempElement) { DEBUG_PRINT(" StreamType = 0x%02X/n",psTempElement->iStreamType); DEBUG_PRINT(" Pid = 0x%04X/n",psTempElement->iPid); if (psTempElement->iProgElDescLength > 0) { DescAttr sDescAttr; iDescCounter=0; { int j; DEBUG_PRINT(" Raw Descriptor/n"); DEBUG_PRINT(" "); for (j = 0; j < psTempElement->iProgElDescLength; j++) { DEBUG_PRINT("0x%02X ",psTempElement->pcProgElDesc[j]&0xFF); } DEBUG_PRINT("/n"); } sDescAttr.eParam = PMT_PRIVATE_DESCRIPTOR_TAG; while (getElementaryPrivateDescPayload(psTempPmt,iElemStreamIdx,iDescCounter,&sDescAttr) == PMT_OK) { DEBUG_PRINT(" Tag 0x%02X, ",sDescAttr.uAttr.iDescTag&0xFF); DEBUG_PRINT("%s/n",getDescTypeString(sDescAttr.uAttr.iDescTag)); memset(&sDescAttr,0,sizeof(DescAttr)); sDescAttr.eParam = PMT_PRIVATE_DESCRIPTOR_PAYLOAD; if (getElementaryPrivateDescPayload(psTempPmt,iElemStreamIdx,iDescCounter,&sDescAttr) == PMT_OK) { int i; DEBUG_PRINT(" Descriptor Payload Length %d/n",sDescAttr.uAttr.sPayload.iPayloadLength); DEBUG_PRINT(" "); for (i=0; i < sDescAttr.uAttr.sPayload.iPayloadLength; i++) { DEBUG_PRINT("0x%02X ",sDescAttr.uAttr.sPayload.pcPayload[i]&0xFF); } DEBUG_PRINT("/n"); } iDescCounter += 1; memset(&sDescAttr,0,sizeof(DescAttr)); sDescAttr.eParam = PMT_PRIVATE_DESCRIPTOR_TAG; } } DEBUG_PRINT("/n"); psTempElement = psTempElement->psNext; iElemStreamIdx += 1; } DEBUG_PRINT("/n"); psTempPmt = psTempPmt->psNext; } }
开发者ID:iourigordon,项目名称:soft_dev,代码行数:77,
示例6: tk_opn_dev_impl//.........这里部分代码省略......... OPNFN openfn; VP exinf;#if TA_GP VP gp;#endif UB pdevnm[L_DEVNM + 1]; INT unitno; ResCB *rescb; DevCB *devcb; OpnCB *opncb; ER ercd; ID semid; unitno = knl_phydevnm(pdevnm, devnm); /* Get resource management information */ rescb = knl_GetResCB(); if ( rescb == NULL ) { ercd = E_CTX; goto err_ret1; } LockDM(); /* Search device to open */ devcb = knl_searchDevCB(pdevnm); if ( devcb == NULL || unitno > devcb->ddev.nsub ) { ercd = E_NOEXS; goto err_ret2; } /* Check open mode */ ercd = chkopenmode(devcb, unitno, omode); if ( ercd < E_OK ) { goto err_ret2; } openfn = (OPNFN)devcb->ddev.openfn; exinf = devcb->ddev.exinf;#if TA_GP gp = devcb->ddev.gp;#endif /* Is device driver call required? */ if ( knl_chkopen(devcb, unitno) && (devcb->ddev.drvatr & TDA_OPENREQ) == 0 ) { openfn = NULL; } /* Get open management block */ opncb = newOpnCB(devcb, unitno, omode, rescb); if ( opncb == NULL ) { ercd = E_LIMIT; goto err_ret2; } semid = tk_cre_sem_impl(&knl_pk_csem_DM); if ( semid < E_OK ) { ercd = E_SYS; goto err_ret2_5; } opncb->abort_semid = semid; UnlockDM(); if ( openfn != NULL ) { /* Device driver call */ DISABLE_INTERRUPT; knl_ctxtsk->sysmode++; ENABLE_INTERRUPT;#if TA_GP ercd = CallDeviceDriver(DEVID(devcb, unitno), omode, exinf, 0, (FP)openfn, gp);#else ercd = (*openfn)(DEVID(devcb, unitno), omode, exinf);#endif DISABLE_INTERRUPT; knl_ctxtsk->sysmode--; ENABLE_INTERRUPT; if ( ercd < E_OK ) { goto err_ret3; } } LockDM(); opncb->resid = 1; /* Indicate that open processing is completed */ UnlockDM(); return DD(opncb);err_ret3: LockDM();err_ret2_5: knl_delOpnCB(opncb, TRUE);err_ret2: UnlockDM();err_ret1: DEBUG_PRINT(("tk_opn_dev_impl ercd = %d/n", ercd)); return ercd;}
开发者ID:chenyifu,项目名称:utkernel-pi,代码行数:101,
示例7: knl_request/* * Request for starting input/output to device */EXPORT ID knl_request( ID dd, W start, VP buf, W size, TMO tmout, INT cmd ){ EXCFN execfn; VP exinf;#if TA_GP VP gp;#endif OpnCB *opncb; DevCB *devcb; ReqCB *reqcb; UINT m; ER ercd; LockDM(); if ( start <= -0x00010000 && start >= -0x7fffffff ) { m = 0; /* Ignore open mode */ } else { m = ( cmd == TDC_READ )? TD_READ: TD_WRITE; } ercd = knl_check_devdesc(dd, m, &opncb); if ( ercd < E_OK ) { goto err_ret1; } devcb = opncb->devcb; execfn = (EXCFN)devcb->ddev.execfn; exinf = devcb->ddev.exinf;#if TA_GP gp = devcb->ddev.gp;#endif /* Get request management block */ reqcb = newReqCB(opncb); if ( reqcb == NULL ) { ercd = E_LIMIT; goto err_ret1; } /* Set request packet */ reqcb->req.next = NULL; reqcb->req.exinf = NULL; reqcb->req.devid = DEVID(devcb, opncb->unitno); reqcb->req.cmd = cmd; reqcb->req.abort = FALSE; reqcb->req.start = start; reqcb->req.size = size; reqcb->req.buf = buf; reqcb->req.asize = 0; reqcb->req.error = 0; /* Indicate that it is during processing */ reqcb->tskid = tk_get_tid_impl(); UnlockDM(); /* Device driver call */ DISABLE_INTERRUPT; knl_ctxtsk->sysmode++; ENABLE_INTERRUPT;#if TA_GP ercd = CallDeviceDriver(&reqcb->req, tmout, exinf, 0, (FP)execfn, gp);#else ercd = (*execfn)(&reqcb->req, tmout, exinf);#endif DISABLE_INTERRUPT; knl_ctxtsk->sysmode--; ENABLE_INTERRUPT; LockDM(); /* Indicate that it is not during processing */ reqcb->tskid = 0; /* If there is an abort completion wait task, notify abort completion */ if ( opncb->abort_tskid > 0 && --opncb->abort_cnt == 0 ) { tk_sig_sem_impl(opncb->abort_semid, 1); } if ( ercd < E_OK ) { goto err_ret2; } UnlockDM(); return REQID(reqcb);err_ret2: knl_delReqCB(reqcb);err_ret1: UnlockDM(); DEBUG_PRINT(("knl_request ercd = %d/n", ercd)); return ercd;}
开发者ID:chenyifu,项目名称:utkernel-pi,代码行数:98,
示例8: MRAILI_Release_vbufvoid MRAILI_Release_vbuf(vbuf* v){#ifdef _ENABLE_UD_ /* This message might be in progress. Wait for ib send completion * to release this buffer to avoid to reusing buffer */ if(v->transport== IB_TRANSPORT_UD && v->flags & UD_VBUF_SEND_INPROGRESS) { v->flags |= UD_VBUF_FREE_PENIDING; return; }#endif /* note this correctly handles appending to empty free list */#if !defined(CKPT) if (MPIDI_CH3I_RDMA_Process.has_srq#if defined(RDMA_CM) || MPIDI_CH3I_RDMA_Process.use_rdma_cm_on_demand#endif /* defined(RDMA_CM) */ || MPIDI_CH3I_Process.cm_type == MPIDI_CH3I_CM_ON_DEMAND)#endif /* !defined(CKPT) */ { pthread_spin_lock(&vbuf_lock); } DEBUG_PRINT("release_vbuf: releasing %p previous head = %p, padding %d/n", v, free_vbuf_head, v->padding);#ifdef _ENABLE_UD_ if(v->transport == IB_TRANSPORT_UD) { MPIU_Assert(v != ud_free_vbuf_head); v->desc.next = ud_free_vbuf_head; ud_free_vbuf_head = v; ++ud_num_free_vbuf; ++ud_num_vbuf_freed; } else #endif /* _ENABLE_UD_ */ { MPIU_Assert(v != free_vbuf_head); v->desc.next = free_vbuf_head; free_vbuf_head = v; ++num_free_vbuf; ++num_vbuf_freed; } if (v->padding != NORMAL_VBUF_FLAG && v->padding != RPUT_VBUF_FLAG && v->padding != RGET_VBUF_FLAG && v->padding != RDMA_ONE_SIDED) { ibv_error_abort(GEN_EXIT_ERR, "vbuf not correct./n"); } *v->head_flag = 0; v->pheader = NULL; v->content_size = 0; v->sreq = NULL; v->vc = NULL;#if !defined(CKPT) if (MPIDI_CH3I_RDMA_Process.has_srq#if defined(RDMA_CM) || MPIDI_CH3I_RDMA_Process.use_rdma_cm_on_demand#endif /* defined(RDMA_CM) */ || MPIDI_CH3I_Process.cm_type == MPIDI_CH3I_CM_ON_DEMAND)#endif /* !defined(CKPT) */ { pthread_spin_unlock(&vbuf_lock); }}
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:70,
示例9: sensorsDeviceInitstatic void sensorsDeviceInit(void){ isMagnetometerPresent = false; isBarometerPresent = false; // Wait for sensors to startup while (xTaskGetTickCount() < 1000); i2cdevInit(I2C3_DEV); mpu6500Init(I2C3_DEV); if (mpu6500TestConnection() == true) { DEBUG_PRINT("MPU9250 I2C connection [OK]./n"); } else { DEBUG_PRINT("MPU9250 I2C connection [FAIL]./n"); } mpu6500Reset(); vTaskDelay(M2T(50)); // Activate MPU6500 mpu6500SetSleepEnabled(false); // Delay until registers are reset vTaskDelay(M2T(100)); // Set x-axis gyro as clock source mpu6500SetClockSource(MPU6500_CLOCK_PLL_XGYRO); // Delay until clock is set and stable vTaskDelay(M2T(200)); // Enable temp sensor mpu6500SetTempSensorEnabled(true); // Disable interrupts mpu6500SetIntEnabled(false); // Connect the MAG and BARO to the main I2C bus mpu6500SetI2CBypassEnabled(true); // Set gyro full scale range mpu6500SetFullScaleGyroRange(SENSORS_GYRO_FS_CFG); // Set accelerometer full scale range mpu6500SetFullScaleAccelRange(SENSORS_ACCEL_FS_CFG); // Set accelerometer digital low-pass bandwidth mpu6500SetAccelDLPF(MPU6500_ACCEL_DLPF_BW_41);#if SENSORS_MPU6500_DLPF_256HZ // 256Hz digital low-pass filter only works with little vibrations // Set output rate (15): 8000 / (1 + 7) = 1000Hz mpu6500SetRate(7); // Set digital low-pass bandwidth mpu6500SetDLPFMode(MPU6500_DLPF_BW_256);#else // To low DLPF bandwidth might cause instability and decrease agility // but it works well for handling vibrations and unbalanced propellers // Set output rate (1): 1000 / (1 + 0) = 1000Hz mpu6500SetRate(0); // Set digital low-pass bandwidth for gyro mpu6500SetDLPFMode(MPU6500_DLPF_BW_98); // Init second order filer for accelerometer for (uint8_t i = 0; i < 3; i++) { lpf2pInit(&gyroLpf[i], 1000, GYRO_LPF_CUTOFF_FREQ); lpf2pInit(&accLpf[i], 1000, ACCEL_LPF_CUTOFF_FREQ); }#endif#ifdef SENSORS_ENABLE_MAG_AK8963 ak8963Init(I2C3_DEV); if (ak8963TestConnection() == true) { isMagnetometerPresent = true; ak8963SetMode(AK8963_MODE_16BIT | AK8963_MODE_CONT2); // 16bit 100Hz DEBUG_PRINT("AK8963 I2C connection [OK]./n"); } else { DEBUG_PRINT("AK8963 I2C connection [FAIL]./n"); }#endif#ifdef SENSORS_ENABLE_PRESSURE_LPS25H lps25hInit(I2C3_DEV); if (lps25hTestConnection() == true) { lps25hSetEnabled(true); isBarometerPresent = true; DEBUG_PRINT("LPS25H I2C connection [OK]./n"); } else { //TODO: Should sensor test fail hard if no connection DEBUG_PRINT("LPS25H I2C connection [FAIL]./n"); }#endif cosPitch = cosf(configblockGetCalibPitch() * (float) M_PI/180); sinPitch = sinf(configblockGetCalibPitch() * (float) M_PI/180); cosRoll = cosf(configblockGetCalibRoll() * (float) M_PI/180); sinRoll = sinf(configblockGetCalibRoll() * (float) M_PI/180);}
开发者ID:ISUCTQuadcopterTeam,项目名称:crazyflie-firmware,代码行数:98,
示例10: perf_timer_exit/* *Return the difference between 2 timeval structs * in microseconds */static void perf_timer_exit(void){ DEBUG_PRINT("Perf Timer:NOTIFY :Exiting Performance timer");}
开发者ID:Nan619,项目名称:ltp-ddt,代码行数:8,
示例11: allocate_vbuf_regionstatic int allocate_vbuf_region(int nvbufs){ struct vbuf_region *reg = NULL; void *mem = NULL; int i = 0; vbuf *cur = NULL; void *vbuf_dma_buffer = NULL; int alignment_vbuf = 64; int alignment_dma = getpagesize(); int result = 0; DEBUG_PRINT("Allocating a new vbuf region./n"); if (free_vbuf_head != NULL) { ibv_error_abort(GEN_ASSERT_ERR, "free_vbuf_head = NULL"); } /* are we limiting vbuf allocation? If so, make sure * we dont alloc more than allowed */ if (rdma_vbuf_max > 0) { nvbufs = MIN(nvbufs, rdma_vbuf_max - vbuf_n_allocated); if (nvbufs <= 0) { ibv_error_abort(GEN_EXIT_ERR, "VBUF alloc failure, limit exceeded"); } } reg = (struct vbuf_region *) MPIU_Malloc (sizeof(struct vbuf_region)); if (NULL == reg) { ibv_error_abort(GEN_EXIT_ERR, "Unable to malloc a new struct vbuf_region"); } if (rdma_enable_hugepage) { result = alloc_hugepage_region (®->shmid, &vbuf_dma_buffer, &nvbufs, rdma_vbuf_total_size); } /* do posix_memalign if enable hugepage disabled or failed */ if (rdma_enable_hugepage == 0 || result != 0 ) { reg->shmid = -1; result = posix_memalign(&vbuf_dma_buffer, alignment_dma, nvbufs * rdma_vbuf_total_size); } if ((result!=0) || (NULL == vbuf_dma_buffer)) { ibv_error_abort(GEN_EXIT_ERR, "unable to malloc vbufs DMA buffer"); } if (posix_memalign( (void**) &mem, alignment_vbuf, nvbufs * sizeof(vbuf))) { fprintf(stderr, "[%s %d] Cannot allocate vbuf region/n", __FILE__, __LINE__); return -1; } /* region should be registered for all of the hca */ for (i=0 ; i < rdma_num_hcas; ++i) { reg->mem_handle[i] = ibv_reg_mr( ptag_save[i], vbuf_dma_buffer, nvbufs * rdma_vbuf_total_size, IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE); if (!reg->mem_handle[i]) { /* de-register already registered with other hcas*/ for (i = i-1; i >=0 ; --i) { if (reg->mem_handle[i] != NULL && ibv_dereg_mr(reg->mem_handle[i])) { fprintf(stderr, "[%s %d] Cannot de-register vbuf region/n", __FILE__, __LINE__); } } /* free allocated buffers */ free(vbuf_dma_buffer); free(mem); MPIU_Free(reg); fprintf(stderr, "[%s %d] Cannot register vbuf region/n", __FILE__, __LINE__); return -1; } } MPIU_Memset(mem, 0, nvbufs * sizeof(vbuf)); MPIU_Memset(vbuf_dma_buffer, 0, nvbufs * rdma_vbuf_total_size); vbuf_n_allocated += nvbufs; num_free_vbuf += nvbufs; reg->malloc_start = mem; reg->malloc_buf_start = vbuf_dma_buffer;//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:101,
示例12: MPIDI_CH3I_MRAILI_Cq_pollint MPIDI_CH3I_MRAILI_Cq_poll(vbuf **vbuf_handle, MPIDI_VC_t * vc_req, int receiving, int is_blocking){ int ne, ret; MPIDI_VC_t *vc = NULL; struct ibv_wc wc; vbuf *v; int i = 0; int cq_choice = 0; int num_cqs = 0; int needed; int is_send_completion; int type = T_CHANNEL_NO_ARRIVE; static unsigned long nspin = 0; struct ibv_cq *ev_cq; struct ibv_cq *chosen_cq; void *ev_ctx; MPIDI_CH3I_MRAILI_Pkt_comm_header *p; int myrank; MPIDI_STATE_DECL(MPID_GEN2_MRAILI_CQ_POLL); MPIDI_FUNC_ENTER(MPID_GEN2_MRAILI_CQ_POLL); myrank = PMI_Get_rank(&myrank); *vbuf_handle = NULL; needed = 0; if (!receiving && !vc_req) { type = MPIDI_CH3I_MRAILI_Test_pkt(vbuf_handle); if (type == T_CHANNEL_EXACT_ARRIVE || type == T_CHANNEL_CONTROL_MSG_ARRIVE) goto fn_exit; } if (rdma_iwarp_use_multiple_cq && MV2_IS_CHELSIO_IWARP_CARD(MPIDI_CH3I_RDMA_Process.hca_type) && (MPIDI_CH3I_RDMA_Process.cluster_size != VERY_SMALL_CLUSTER)) { num_cqs = 2; } else { num_cqs = 1; } for (; i < rdma_num_hcas; ++i) { for (cq_choice = 0; cq_choice < num_cqs; ++cq_choice) { if (1 == num_cqs) { chosen_cq = MPIDI_CH3I_RDMA_Process.cq_hndl[i]; } else { if (0 == cq_choice) { chosen_cq = MPIDI_CH3I_RDMA_Process.send_cq_hndl[i]; } else { chosen_cq = MPIDI_CH3I_RDMA_Process.recv_cq_hndl[i]; } } ne = ibv_poll_cq(chosen_cq, 1, &wc); if (ne < 0 ) { ibv_error_abort(IBV_RETURN_ERR, "Fail to poll cq/n"); } else if (ne) { v = (vbuf *) ((uintptr_t) wc.wr_id); vc = (MPIDI_VC_t *) (v->vc); cq_poll_completion = 1; if (wc.status != IBV_WC_SUCCESS) { if (wc.opcode == IBV_WC_SEND || wc.opcode == IBV_WC_RDMA_WRITE ) { fprintf(stderr, "[%d->%d] send desc error, wc_opcode=%d/n",myrank, vc->pg_rank, wc.opcode ); } else { fprintf(stderr, "[%d<-%d] recv desc error, wc_opcode=%d/n",myrank, vc->pg_rank, wc.opcode); } fprintf(stderr, "[%d->%d] wc.status=%d, wc.wr_id=%p, wc.opcode=%d, vbuf->phead->type=%d = %s/n", myrank, vc->pg_rank, wc.status, v, wc.opcode,((MPIDI_CH3I_MRAILI_Pkt_comm_header*)v->pheader)->type, MPIDI_CH3_Pkt_type_to_string[((MPIDI_CH3I_MRAILI_Pkt_comm_header*)v->pheader)->type] ); ibv_va_error_abort(IBV_STATUS_ERR, "[] Got completion with error %d, " "vendor code=0x%x, dest rank=%d/n", wc.status, wc.vendor_err, ((MPIDI_VC_t *)v->vc)->pg_rank ); } is_send_completion = (wc.opcode == IBV_WC_SEND || wc.opcode == IBV_WC_RDMA_WRITE || wc.opcode == IBV_WC_RDMA_READ); if (2 == num_cqs) { if (0 == cq_choice) { if (MPIDI_CH3I_RDMA_Process.global_used_send_cq) { MPIDI_CH3I_RDMA_Process.global_used_send_cq--; } else { DEBUG_PRINT("[%d] Possibly received a duplicate / send completion event /n", MPIDI_Process.my_pg_rank); } } } else { if(is_send_completion && (MPIDI_CH3I_RDMA_Process.global_used_send_cq > 0)) {//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:101,
示例13: MPIDI_CH3I_MRAILI_Waiting_msgint MPIDI_CH3I_MRAILI_Waiting_msg(MPIDI_VC_t * vc, vbuf ** vbuf_handle, int blocking) { MRAILI_Channel_manager * cmanager = &vc->mrail.cmanager; int i = 0; int seq; int seq_expected = vc->mrail.seqnum_next_torecv; int type = T_CHANNEL_NO_ARRIVE; MPIDI_STATE_DECL(MPID_GEN2_MPIDI_CH3I_MRAILIWAITING_MSG); MPIDI_FUNC_ENTER(MPID_GEN2_MPIDI_CH3I_MRAILIWAITING_MSG); *vbuf_handle = NULL; if (blocking) { DEBUG_PRINT("{entering} solve_out_of_order next expected %d, channel %d, head %p (%d)/n", vc->mrail.seqnum_next_torecv, cmanager->num_channels, cmanager->msg_channels[0].v_queue_head, GetSeqNumVbuf(cmanager->msg_channels[0].v_queue_head)); } for (; i < cmanager->num_channels; ++i) { seq = GetSeqNumVbuf(cmanager->msg_channels[i].v_queue_head); if (seq == seq_expected) { *vbuf_handle = VQUEUE_DEQUEUE(cmanager, i); type = T_CHANNEL_EXACT_ARRIVE; ++vc->mrail.seqnum_next_torecv; goto fn_exit; } else if (PKT_NO_SEQ_NUM == seq) { *vbuf_handle = VQUEUE_DEQUEUE(cmanager, i); type = T_CHANNEL_CONTROL_MSG_ARRIVE; goto fn_exit; } else if (PKT_IS_NULL == seq) { /* Do nothing */ } else { *vbuf_handle = cmanager->msg_channels[i].v_queue_head; type = T_CHANNEL_OUT_OF_ORDER_ARRIVE; } } /* Obviously the packet with correct sequence hasn't arrived */ while (blocking) { /* poll local subrails*/ for (i = 0; i < cmanager->num_local_pollings; ++i) { seq = GetSeqNumVbuf(cmanager->msg_channels[INDEX_LOCAL(cmanager,i)].v_queue_head); if (seq == seq_expected) { *vbuf_handle = VQUEUE_DEQUEUE(cmanager, INDEX_LOCAL(cmanager,i)); ++vc->mrail.seqnum_next_torecv; type = T_CHANNEL_EXACT_ARRIVE; goto fn_exit; } else if (seq == PKT_NO_SEQ_NUM) { *vbuf_handle = VQUEUE_DEQUEUE(cmanager, INDEX_LOCAL(cmanager,i)); type = T_CHANNEL_CONTROL_MSG_ARRIVE; goto fn_exit; } else if (vc->mrail.rfp.in_polling_set) { *vbuf_handle = MPIDI_CH3I_RDMA_poll(vc); seq = GetSeqNumVbuf(*vbuf_handle); if (seq == seq_expected) { type = T_CHANNEL_EXACT_ARRIVE; ++vc->mrail.seqnum_next_torecv; goto fn_exit; } else if( seq == PKT_NO_SEQ_NUM) { type = T_CHANNEL_CONTROL_MSG_ARRIVE; goto fn_exit; } else if (*vbuf_handle != NULL){ VQUEUE_ENQUEUE(cmanager, INDEX_LOCAL(cmanager,i), *vbuf_handle); *vbuf_handle = NULL; } } } type = MPIDI_CH3I_MRAILI_Cq_poll(vbuf_handle, vc, 0, blocking); if (type != T_CHANNEL_NO_ARRIVE) { switch(type) { case (T_CHANNEL_EXACT_ARRIVE): goto fn_exit; case (T_CHANNEL_OUT_OF_ORDER_ARRIVE): continue; case (T_CHANNEL_CONTROL_MSG_ARRIVE): goto fn_exit; default: ibv_error_abort(GEN_ASSERT_ERR, "Unexpected return type/n"); break; } } else { } } fn_exit: if (blocking) { DEBUG_PRINT("{return} solve_out_of_order, type %d, next expected %d/n", type, vc->mrail.seqnum_next_torecv); } MPIDI_FUNC_EXIT(MPID_GEN2_MPIDI_CH3I_MRAILIWAITING_MSG); return type;}
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:97,
示例14: MPIDI_CH3I_MRAILI_Get_next_vbufint MPIDI_CH3I_MRAILI_Get_next_vbuf(MPIDI_VC_t** vc_ptr, vbuf** vbuf_ptr) { *vc_ptr = NULL; *vbuf_ptr = NULL; VBUF_FLAG_TYPE size; int type; MPIDI_STATE_DECL(MPID_GEN2_MPIDI_CH3I_MRAILI_GET_NEXT_VBUF); MPIDI_FUNC_ENTER(MPID_GEN2_MPIDI_CH3I_MRAILI_GET_NEXT_VBUF); type = MPIDI_CH3I_MRAILI_Test_pkt(vbuf_ptr); switch(type) { case T_CHANNEL_CONTROL_MSG_ARRIVE: case T_CHANNEL_EXACT_ARRIVE: *vc_ptr = (*vbuf_ptr)->vc; goto fn_exit; case T_CHANNEL_OUT_OF_ORDER_ARRIVE: type = T_CHANNEL_NO_ARRIVE; *vbuf_ptr = NULL; break; } if (num_rdma_buffer == 0) { goto fn_exit; } int i = 0; MPIDI_VC_t* vc = NULL; int seq; vbuf* v = NULL; volatile VBUF_FLAG_TYPE* tail = NULL; volatile VBUF_FLAG_TYPE* head = NULL; /* no msg is queued, poll rdma polling set */ for (; i < MPIDI_CH3I_RDMA_Process.polling_group_size; ++i) { vc = MPIDI_CH3I_RDMA_Process.polling_set[i]; seq = GetSeqNumVbuf(vc->mrail.cmanager.msg_channels[INDEX_LOCAL(&vc->mrail.cmanager,0)].v_queue_head); if (seq == PKT_IS_NULL) { v = &(vc->mrail.rfp.RDMA_recv_buf[vc->mrail.rfp.p_RDMA_recv]); head = v->head_flag; if (*head && vc->mrail.rfp.p_RDMA_recv != vc->mrail.rfp.p_RDMA_recv_tail) { size = (*head & FAST_RDMA_SIZE_MASK); tail = (VBUF_FLAG_TYPE *) (v->buffer + size); /* If the tail has not received yet, than go ahead and ** poll next connection */ if (*head != *tail) { continue; } DEBUG_PRINT("Get one!/n"); if (++vc->mrail.rfp.p_RDMA_recv >= num_rdma_buffer) { vc->mrail.rfp.p_RDMA_recv = 0; } v->pheader = v->buffer; v->content_size = size; *head = 0; seq = GetSeqNumVbuf(v);#ifdef _ENABLE_UD_ if (rdma_enable_hybrid){ v->seqnum = seq; type = T_CHANNEL_HYBRID_MSG_ARRIVE; *vbuf_ptr = v; *vc_ptr = v->vc; PRINT_DEBUG(DEBUG_UD_verbose>1,"received seqnum:%d expected:%d vc_ptr:%p/n",seq, vc->mrail.seqnum_next_torecv, v->vc); goto fn_exit; } else#endif { if (seq == vc->mrail.seqnum_next_torecv) { DEBUG_PRINT("Get one exact seq: %d/n", seq); type = T_CHANNEL_EXACT_ARRIVE; ++vc->mrail.seqnum_next_torecv; *vbuf_ptr = v; *vc_ptr = v->vc; goto fn_exit; } else if (seq == PKT_NO_SEQ_NUM) { type = T_CHANNEL_CONTROL_MSG_ARRIVE; DEBUG_PRINT("[vbuf_local]: get control msg/n"); *vbuf_ptr = v; *vc_ptr = v->vc; goto fn_exit; } else {//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:101,
示例15: usbOpenDevicestatic int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName, int product, char *productName, int usesReportIDs){ GUID hidGuid; /* GUID for HID driver */ HDEVINFO deviceInfoList; SP_DEVICE_INTERFACE_DATA deviceInfo; SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL; DWORD size; int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */ int errorCode = USB_ERROR_NOTFOUND; HANDLE handle = INVALID_HANDLE_VALUE; HIDD_ATTRIBUTES deviceAttributes; HidD_GetHidGuid(&hidGuid); deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); deviceInfo.cbSize = sizeof(deviceInfo); for(i=0;;i++){ if(handle != INVALID_HANDLE_VALUE){ CloseHandle(handle); handle = INVALID_HANDLE_VALUE; } if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo)) break; /* no more entries */ /* first do a dummy call just to determine the actual size required */ SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL); if(deviceDetails != NULL) free(deviceDetails); deviceDetails = malloc(size); deviceDetails->cbSize = sizeof(*deviceDetails); /* this call is for real: */ SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails, size, &size, NULL); DEBUG_PRINT(("checking HID path /"%s/"/n", deviceDetails->DevicePath)); /* attempt opening for R/W -- we don't care about devices which can't be accessed */ handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL); if(handle == INVALID_HANDLE_VALUE){ DEBUG_PRINT(("opening failed: %d/n", (int)GetLastError())); /* errorCode = USB_ERROR_ACCESS; opening will always fail for mouse -- ignore */ continue; } deviceAttributes.Size = sizeof(deviceAttributes); HidD_GetAttributes(handle, &deviceAttributes); DEBUG_PRINT(("device attributes: vid=%d pid=%d/n", deviceAttributes.VendorID, deviceAttributes.ProductID)); if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product) continue; /* ignore this device */ errorCode = USB_ERROR_NOTFOUND; if(vendorName != NULL && productName != NULL){ char buffer[512]; if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){ DEBUG_PRINT(("error obtaining vendor name/n")); errorCode = USB_ERROR_IO; continue; } convertUniToAscii(buffer); DEBUG_PRINT(("vendorName = /"%s/"/n", buffer)); if(strcmp(vendorName, buffer) != 0) continue; if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){ DEBUG_PRINT(("error obtaining product name/n")); errorCode = USB_ERROR_IO; continue; } convertUniToAscii(buffer); DEBUG_PRINT(("productName = /"%s/"/n", buffer)); if(strcmp(productName, buffer) != 0) continue; } break; /* we have found the device we are looking for! */ } SetupDiDestroyDeviceInfoList(deviceInfoList); if(deviceDetails != NULL) free(deviceDetails); if(handle != INVALID_HANDLE_VALUE){ fdp->pfd = (void *)handle; errorCode = 0; } return errorCode;}
开发者ID:JasonBeard,项目名称:usbprog5,代码行数:82,
示例16: saveClientStateshort saveClientState(ParseClientInternal *parseClient) {#ifdef CLIENT_DEBUG DEBUG_PRINT("[Parse] Saving client state/r/n");#endif /* CLIENT_DEBUG */ snprintf(clientStateFileName, CLIENT_STATE_FILENAME_LEN, CLIENT_STATE_FILENAME, parseClient->applicationId); long clientStateFile = -1; sl_FsDel((unsigned char *)clientStateFileName, 0); short status = sl_FsOpen((unsigned char *)clientStateFileName, FS_MODE_OPEN_CREATE(65536, _FS_FILE_OPEN_FLAG_COMMIT | _FS_FILE_PUBLIC_WRITE), NULL, &clientStateFile); if (status < 0) {#ifdef CLIENT_DEBUG if (status == SL_FS_ERR_NO_AVAILABLE_BLOCKS) { DEBUG_PRINT("[Parse] No available blocks. Need to flash your device file system.../r/n"); }#endif /* CLIENT_DEBUG */ return status; } sl_FsClose(clientStateFile, 0, 0, 0); clientStateFile = -1; status = sl_FsOpen((unsigned char *)clientStateFileName, FS_MODE_OPEN_WRITE, NULL, &clientStateFile); if (status < 0) {#ifdef CLIENT_DEBUG if (status == SL_FS_ERR_NO_AVAILABLE_BLOCKS) { DEBUG_PRINT("[Parse] No available blocks. Need to flash your device file system.../r/n"); }#endif /* CLIENT_DEBUG */ sl_FsClose(clientStateFile, 0, 0, 0); return status; }#ifdef CLIENT_DEBUG DEBUG_PRINT("[Parse] Installation Id: %s/r/n", parseClient->installationId);#endif /* CLIENT_DEBUG */ long writeOffset = 0; status = sl_FsWrite(clientStateFile, writeOffset, (unsigned char *)parseClient->installationId, sizeof(parseClient->installationId)); if (status < 0) {#ifdef CLIENT_DEBUG if (status == SL_FS_ERR_NO_AVAILABLE_BLOCKS) { DEBUG_PRINT("[Parse] No available blocks. Need to flash your device file system.../r/n"); }#endif /* CLIENT_DEBUG */ sl_FsClose(clientStateFile, 0, 0, 0); return status; }#ifdef CLIENT_DEBUG DEBUG_PRINT("[Parse] Session token: %s/r/n", parseClient->sessionToken);#endif /* CLIENT_DEBUG */ writeOffset = writeOffset + status; status = sl_FsWrite(clientStateFile, writeOffset, (unsigned char *)parseClient->sessionToken, sizeof(parseClient->sessionToken)); if (status < 0) {#ifdef CLIENT_DEBUG if (status == SL_FS_ERR_NO_AVAILABLE_BLOCKS) { DEBUG_PRINT("[Parse] No available blocks. Need to flash your device file system.../r/n"); }#endif /* CLIENT_DEBUG */ sl_FsClose(clientStateFile, 0, 0, 0); return status; }#ifdef CLIENT_DEBUG DEBUG_PRINT("[Parse] Last push time: %s/r/n", parseClient->lastPushTime);#endif /* CLIENT_DEBUG */ writeOffset = writeOffset + status; status = sl_FsWrite(clientStateFile, writeOffset, (unsigned char *)parseClient->lastPushTime, sizeof(parseClient->lastPushTime)); if (status < 0) {#ifdef CLIENT_DEBUG if (status == SL_FS_ERR_NO_AVAILABLE_BLOCKS) { DEBUG_PRINT("[Parse] No available blocks. Need to flash your device file system.../r/n"); }#endif /* CLIENT_DEBUG */ sl_FsClose(clientStateFile, 0, 0, 0); return status; } sl_FsClose(clientStateFile, 0, 0, 0); return status;}
开发者ID:DatzZDeVesh,项目名称:parse-embedded-sdks,代码行数:86,
示例17: tk_sus_dev_impl/* * Suspend processing */SYSCALL INT tk_sus_dev_impl( UINT mode ){ ResCB *rescb; BOOL suspend = FALSE; ER ercd; /* Get resource management information */ rescb = knl_GetResCB(); if ( rescb == NULL ) { ercd = E_CTX; goto err_ret1; } LockDM(); switch ( mode & 0xf ) { case TD_SUSPEND: /* Suspend */ if ( knl_DisSusCnt > 0 && (mode & TD_FORCE) == 0 ) { ercd = E_BUSY; goto err_ret2; } suspend = TRUE; break; case TD_DISSUS: /* Disable suspend */ if ( knl_DisSusCnt >= MAX_DISSUS ) { ercd = E_QOVR; goto err_ret2; } knl_DisSusCnt++; rescb->dissus++; break; case TD_ENASUS: /* Enable suspend */ if ( rescb->dissus > 0 ) { rescb->dissus--; knl_DisSusCnt--; } break; case TD_CHECK: /* Get suspend disable request count */ break; default: ercd = E_PAR; goto err_ret2; } UnlockDM(); if ( suspend ) { /* Suspend */ ercd = do_suspend(); if ( ercd < E_OK ) { goto err_ret1; } } return knl_DisSusCnt;err_ret2: UnlockDM();err_ret1: DEBUG_PRINT(("tk_sus_dev_impl ercd = %d/n", ercd)); return ercd;}
开发者ID:chenyifu,项目名称:utkernel-pi,代码行数:68,
示例18: parse_headerbool parse_header(uint64_t *address, s_acpi *acpi) { s_acpi_description_header adh; memset(&adh, 0, sizeof(adh)); get_acpi_description_header((uint8_t *)address, &adh); /* Trying to determine the pointed table */ /* Looking for FADT */ if (memcmp(adh.signature, FACP, sizeof(FACP) - 1) == 0) { DEBUG_PRINT(("FACP table found/n")); s_fadt *f = &acpi->fadt; s_facs *fa = &acpi->facs; s_dsdt *d = &acpi->dsdt; /* This structure is valid, let's fill it */ f->valid = true; f->address = address; memcpy(&f->header, &adh, sizeof(adh)); parse_fadt(f); /* FACS wasn't already detected * FADT points to it, let's try to detect it */ if (fa->valid == false) { fa->address = (uint64_t *)f->x_firmware_ctrl; parse_facs(fa); if (fa->valid == false) { /* Let's try again */ fa->address = (uint64_t *)f->firmware_ctrl; parse_facs(fa); } } /* DSDT wasn't already detected * FADT points to it, let's try to detect it */ if (d->valid == false) { s_acpi_description_header new_adh; get_acpi_description_header((uint8_t *)f->x_dsdt, &new_adh); if (memcmp(new_adh.signature, DSDT, sizeof(DSDT) - 1) == 0) { DEBUG_PRINT(("DSDT table found via x_dsdt/n")); d->valid = true; d->address = (uint64_t *)f->x_dsdt; memcpy(&d->header, &new_adh, sizeof(new_adh)); parse_dsdt(d); } else { /* Let's try again */ get_acpi_description_header((uint8_t *)f->dsdt_address, &new_adh); if (memcmp(new_adh.signature, DSDT, sizeof(DSDT) - 1) == 0) { DEBUG_PRINT(("DSDT table found via dsdt_address/n")); d->valid = true; d->address = (uint64_t *)f->dsdt_address; memcpy(&d->header, &new_adh, sizeof(new_adh)); parse_dsdt(d); } } } } /* Looking for MADT */ else if (memcmp(adh.signature, APIC, sizeof(APIC) - 1) == 0) { DEBUG_PRINT(("MADT table found/n")); s_madt *m = &acpi->madt; /* This structure is valid, let's fill it */ m->valid = true; m->address =address; memcpy(&m->header, &adh, sizeof(adh)); parse_madt(acpi); } else if (memcmp(adh.signature, DSDT, sizeof(DSDT) - 1) == 0) { DEBUG_PRINT(("DSDT table found/n")); s_dsdt *d = &acpi->dsdt; /* This structure is valid, let's fill it */ d->valid = true; d->address = address; memcpy(&d->header, &adh, sizeof(adh)); parse_dsdt(d); /* PSDT have to be considered as SSDT. Intel ACPI Spec @ 5.2.11.3 */ } else if ((memcmp(adh.signature, SSDT, sizeof(SSDT) - 1) == 0) || (memcmp(adh.signature, PSDT, sizeof(PSDT) - 1) == 0)) { DEBUG_PRINT(("SSDT table found with %s /n",adh.signature)); if ((acpi->ssdt_count >= MAX_SSDT - 1)) return false; /* We can have many SSDT, so let's allocate a new one */ if ((acpi->ssdt[acpi->ssdt_count] = malloc(sizeof(s_ssdt))) == NULL) return false; s_ssdt *s = acpi->ssdt[acpi->ssdt_count]; /* This structure is valid, let's fill it */ s->valid = true; s->address = address; memcpy(&s->header, &adh, sizeof(adh)); /* Searching how much definition blocks we must copy */ uint32_t definition_block_size = adh.length - ACPI_HEADER_SIZE; if ((s->definition_block = malloc(definition_block_size)) != NULL) { memcpy(s->definition_block, (s->address + ACPI_HEADER_SIZE),//.........这里部分代码省略.........
开发者ID:1stMaster,项目名称:syslinux,代码行数:101,
示例19: knl_close_device/* * Device close processing */EXPORT ER knl_close_device( OpnCB *opncb, UINT option ){ CLSFN closefn; VP exinf;#if TA_GP VP gp;#endif ID devid; DevCB *devcb; INT unitno; ER ercd = E_OK; /* Abort all requests during processing */ abort_allrequest(opncb); LockDM(); devcb = opncb->devcb; unitno = opncb->unitno; closefn = (CLSFN)devcb->ddev.closefn; exinf = devcb->ddev.exinf;#if TA_GP gp = devcb->ddev.gp;#endif devid = DEVID(devcb, unitno); /* Delete semaphore for completion check of abortion */ tk_del_sem_impl(opncb->abort_semid); /* Free open management block */ knl_delOpnCB(opncb, FALSE); /* Is device driver call required? */ if ( knl_chkopen(devcb, unitno) ) { option &= ~TD_EJECT; if ( (devcb->ddev.drvatr & TDA_OPENREQ) == 0 ) { closefn = NULL; } } UnlockDM(); if ( closefn != NULL ) { /* Device driver call */ DISABLE_INTERRUPT; knl_ctxtsk->sysmode++; ENABLE_INTERRUPT;#if TA_GP ercd = CallDeviceDriver(devid, option, exinf, 0, (FP)closefn, gp);#else ercd = (*closefn)(devid, option, exinf);#endif DISABLE_INTERRUPT; knl_ctxtsk->sysmode--; ENABLE_INTERRUPT; } LockDM(); /* Return open management block to FreeQue */ QueInsert(&opncb->q, &knl_FreeOpnCB); UnlockDM();#ifdef DEBUG if ( ercd < E_OK ) { DEBUG_PRINT(("knl_close_device ercd = %d/n", ercd)); }#endif return ercd;}
开发者ID:chenyifu,项目名称:utkernel-pi,代码行数:72,
示例20: get_djvu_hyperlink_mappingjobject get_djvu_hyperlink_mapping(JNIEnv *jenv, ddjvu_document_t* djvu_document, ddjvu_pageinfo_t *page_info, miniexp_t sexp){ miniexp_t iter; const char *url, *url_target; jobject hl = NULL; iter = sexp; if (miniexp_car(iter) != miniexp_symbol("maparea")) { DEBUG_PRINT("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp))); return hl; } iter = miniexp_cdr(iter); if (miniexp_caar(iter) == miniexp_symbol("url")) { if (!string_from_miniexp(miniexp_cadr(miniexp_car(iter)), &url)) { DEBUG_PRINT("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp))); return hl; } if (!string_from_miniexp(miniexp_caddr(miniexp_car(iter)), &url_target)) { DEBUG_PRINT("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp))); return hl; } } else { if (!string_from_miniexp(miniexp_car(iter), &url)) { DEBUG_PRINT("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp))); return hl; } url_target = NULL; } iter = miniexp_cdr(iter); /* FIXME: DjVu hyperlink comments are ignored */ int len = 0; int type; jint* data; iter = miniexp_cdr(iter); if ((data = get_djvu_hyperlink_area(page_info, miniexp_car(iter), type, len)) == NULL) { DEBUG_PRINT("DjvuLibre error: Unknown hyperlink %s", miniexp_to_name(miniexp_car(sexp))); return hl; } iter = miniexp_cdr(iter); /* FIXME: DjVu hyperlink attributes are ignored */ DEBUG_PRINT("DjvuLibre: Hyperlink url: %s url_target: %s", url, url_target); if (!url) { delete[] data; return hl; } jclass pagelinkClass = jenv->FindClass("org/ebookdroid/core/codec/PageLink"); if (!pagelinkClass) { delete[] data; return hl; } jmethodID plInitMethodId = jenv->GetMethodID(pagelinkClass, "<init>", "(Ljava/lang/String;I[I)V"); if (!plInitMethodId) { delete[] data; return hl; } jintArray points = jenv->NewIntArray(len); jenv->SetIntArrayRegion(points, 0, len, data); jstring jstr = jenv->NewStringUTF(url); hl = jenv->NewObject(pagelinkClass, plInitMethodId, jstr, (jint) type, points); jenv->DeleteLocalRef(jstr); jenv->DeleteLocalRef(points); delete[] data;// DEBUG_PRINT("DjvuLibre: Hyperlink url: %s url_target: %s", url, url_target); return hl;}
开发者ID:JMQCode,项目名称:iBooks,代码行数:96,
示例21: tk_wai_dev_impl//.........这里部分代码省略......... for ( nreq = 1;; nreq++ ) { reqcb->tskid = tskid; devreq = &reqcb->req; reqcb = (ReqCB*)reqcb->q.next; if ( reqcb == (ReqCB*)&opncb->requestq ) { break; } devreq->next = &reqcb->req; } devreq->next = NULL; devreq = &((ReqCB*)opncb->requestq.next)->req; opncb->waireqlst = devreq; opncb->nwaireq = nreq; } else { /* Wait for completion of abort request processing */ reqcb = knl_check_reqid(reqid, opncb); if ( reqcb == NULL ) { ercd = E_ID; goto err_ret2; } if ( opncb->nwaireq > 0 || reqcb->tskid > 0 ) { ercd = E_OBJ; goto err_ret2; } /* Create waiting request list */ reqcb->tskid = tskid; devreq = &reqcb->req; devreq->next = NULL; nreq = 1; opncb->waitone++; } UnlockDM(); /* Device driver call */ DISABLE_INTERRUPT; knl_ctxtsk->sysmode++; ENABLE_INTERRUPT;#if TA_GP reqno = CallDeviceDriver(devreq, nreq, tmout, exinf, (FP)waitfn, gp);#else reqno = (*waitfn)(devreq, nreq, tmout, exinf);#endif DISABLE_INTERRUPT; knl_ctxtsk->sysmode--; ENABLE_INTERRUPT; if ( reqno < E_OK ) { ercd = reqno; } if ( reqno >= nreq ) { ercd = E_SYS; } LockDM(); /* Free wait processing */ if ( reqid == 0 ) { opncb->nwaireq = 0; } else { opncb->waitone--; } /* If there is an abort completion wait task, notify abort completion */ if ( opncb->abort_tskid > 0 && --opncb->abort_cnt == 0 ) { tk_sig_sem_impl(opncb->abort_semid, 1); } /* Get processing result */ while ( devreq != NULL ) { reqcb = DEVREQ_REQCB(devreq); if ( reqno-- == 0 ) { reqid = REQID(reqcb); *asize = devreq->asize; *ioer = devreq->error; } reqcb->tskid = 0; devreq = devreq->next; } if ( ercd < E_OK ) { goto err_ret2; } /* Unregister completed request */ knl_delReqCB(REQCB(reqid)); UnlockDM(); return reqid;err_ret2: UnlockDM(); DEBUG_PRINT(("tk_wai_dev_impl ercd = %d/n", ercd)); return ercd;}
开发者ID:chenyifu,项目名称:utkernel-pi,代码行数:101,
示例22: Java_org_ebookdroid_droids_djvu_codec_DjvuDocument_getPageextern "C" jlong Java_org_ebookdroid_droids_djvu_codec_DjvuDocument_getPage(JNIEnv *env, jclass cls, jlong docHandle, jint pageNumber){ DEBUG_PRINT("getPage num: %d", pageNumber); return (jlong) ddjvu_page_create_by_pageno((ddjvu_document_t*) docHandle, pageNumber);}
开发者ID:JMQCode,项目名称:iBooks,代码行数:6,
示例23: createPmtTablePMT_ERROR createPmtTable(int iPid, int iProgNumber, PmtTable** ppsPmtTable){ RootPidPacket* psTempPidRootNode; PacketNode* psStartNode; ProgElement* psTempProgElement; bool bFoundPrivateSection; char* pcPrivateSectionAssembly; int iCurrPos,iSectionLength,iBytesRead; psTempPidRootNode = getPidRootNode(iPid); if (psTempPidRootNode == NULL) { /*log*/ DEBUG_PRINT("Coudn't find PMT PID 0x%02X/n",iPid); return PMT_INVALID_PID; } /* * more then one PMT table can be carried on the same PID. We need to find private section * that has PMT table we are looking for here */ bFoundPrivateSection = false; psStartNode = psTempPidRootNode->psThisPID; while (psStartNode && !bFoundPrivateSection) { pcPrivateSectionAssembly = assemblePrivateSection(psStartNode); if (pcPrivateSectionAssembly) { /*process private section*/ if (pcPrivateSectionAssembly[FIRST_BYTE] == PMT_TABLE_ID) { iSectionLength = (((pcPrivateSectionAssembly[SECND_BYTE]&0xF)<<8)|pcPrivateSectionAssembly[THIRD_BYTE])&0x0FFF; /*check why we get negative section length*/ if (iProgNumber == 9200) { DEBUG_PRINT("iSectionLength = %d/n",iSectionLength); DEBUG_PRINT("pcPrivateSectionAssembly[FORTH_BYTE] = 0x%04X/n",pcPrivateSectionAssembly[FORTH_BYTE]&0xFF); DEBUG_PRINT("pcPrivateSectionAssembly[FORTH_BYTE]<<8 = 0x%04X/n",pcPrivateSectionAssembly[FORTH_BYTE]&0xFF<<8); DEBUG_PRINT("pcPrivateSectionAssembly[FIFTH_BYTE] = 0x%04X/n",pcPrivateSectionAssembly[FIFTH_BYTE]&0xFF); DEBUG_PRINT("((pcPrivateSectionAssembly[FORTH_BYTE]<<8)|pcPrivateSectionAssembly[FIFTH_BYTE]) 0x%04X/n", ((pcPrivateSectionAssembly[FORTH_BYTE]&0xFF<<8)|(pcPrivateSectionAssembly[FIFTH_BYTE]&0xFF))); DEBUG_PRINT("(int)((pcPrivateSectionAssembly[FORTH_BYTE]<<8)|pcPrivateSectionAssembly[FIFTH_BYTE]) 0x%04X/n", (int)((pcPrivateSectionAssembly[FORTH_BYTE]&0xFF<<8)|(pcPrivateSectionAssembly[FIFTH_BYTE]&0xFF))); DEBUG_PRINT("Candidate %d for PMT %d/n", ((pcPrivateSectionAssembly[FORTH_BYTE]&0xFF<<8)|(pcPrivateSectionAssembly[FIFTH_BYTE]&0xFF)), iProgNumber); } if ((int)((pcPrivateSectionAssembly[FORTH_BYTE]&0xFF<<8)|(pcPrivateSectionAssembly[FIFTH_BYTE]&0xFF)) == iProgNumber) { DEBUG_PRINT("Found %d/n",iProgNumber); bFoundPrivateSection = true; } } } if (!bFoundPrivateSection) { //DEBUG_PRINT("Trying next packet/n"); if(pcPrivateSectionAssembly != NULL) { free(pcPrivateSectionAssembly),pcPrivateSectionAssembly=NULL; } psStartNode = psStartNode->psNextPacket; } } if (!bFoundPrivateSection) { //DEBUG_PRINT("Could not find private section/n"); return PMT_NOT_FOUND; } *ppsPmtTable = malloc(sizeof(PmtTable)); memset(*ppsPmtTable,0,sizeof(PmtTable)); (*ppsPmtTable)->iProgNumber = iProgNumber; (*ppsPmtTable)->iVersionNumber = (pcPrivateSectionAssembly[SIXTH_BYTE]&0x3E)>>1; (*ppsPmtTable)->bValidPmt = pcPrivateSectionAssembly[SIXTH_BYTE]&0x1; (*ppsPmtTable)->iPcrPid = (((pcPrivateSectionAssembly[NINTH_BYTE]&0x1F)<<8)| (pcPrivateSectionAssembly[TENTH_BYTE]&0xFF)); (*ppsPmtTable)->iOuterDescLength = ((pcPrivateSectionAssembly[ELVTH_BYTE]&0x3)<<8)| (pcPrivateSectionAssembly[TWVTH_BYTE]&0xFF); if ((*ppsPmtTable)->iOuterDescLength > 0) { (*ppsPmtTable)->pcOuterDesc = pcPrivateSectionAssembly + TWVTH_BYTE + 1; }#if 0 if (iProgNumber == 9216) { PacketNode* psFileNode; FILE* fpPmtDump; int iPrivCounter; fpPmtDump = fopen("./pmt9216.bin","w"); for (iPrivCounter = 0; iPrivCounter < 64; iPrivCounter ++) { fwrite(pcPrivateSectionAssembly+iPrivCounter,1,1,fpPmtDump); } fclose(fpPmtDump);//.........这里部分代码省略.........
开发者ID:iourigordon,项目名称:soft_dev,代码行数:101,
示例24: Java_org_ebookdroid_droids_djvu_codec_DjvuPage_getPageLinksextern "C" jobject Java_org_ebookdroid_droids_djvu_codec_DjvuPage_getPageLinks(JNIEnv *env, jclass cls, jlong docHandle, jint pageNumber){ DEBUG_PRINT("getPageLinks num: %d", pageNumber); return djvu_links_get_links(env, (ddjvu_document_t*) docHandle, pageNumber);}
开发者ID:JMQCode,项目名称:iBooks,代码行数:6,
示例25: getElementaryPrivateDescPayload/* * if iElementIdx is set to positive value, it will return inner loop descriptor, * if iElementIdx is set to negative value, it will return outer (PMT) descriptor*/PMT_ERROR getElementaryPrivateDescPayload(PmtTable* psPmtTable, int iElementIdx, int iDescIdx, DescAttr* psDescAttr){ int iTempDescIdx,iDescOffset,iDescLength; char* pcCurrent; char* pcRawDesc; if (iElementIdx >= 0) { ProgElement* psTempElementStream; if (getPmtElementStreamByIdx(psPmtTable,&psTempElementStream,iElementIdx) != PMT_OK) { DEBUG_PRINT("Did not find elementary stream/n"); return PMT_NOT_FOUND; } pcCurrent = psTempElementStream->pcProgElDesc; iDescLength = psTempElementStream->iProgElDescLength; } else { pcCurrent = psPmtTable->pcOuterDesc; iDescLength = psPmtTable->iOuterDescLength; } if (pcCurrent == NULL) { DEBUG_PRINT("Did not find outer descriptor/n"); memset(psDescAttr,0,sizeof(DescAttr)); return PMT_NOT_FOUND; } pcRawDesc = pcCurrent; iTempDescIdx = 0; iDescOffset = 0; while (iTempDescIdx != iDescIdx) { /* * 2 is for descriptor tag plus descriptor length byte itself * *(pcCurrent + 1) isthe descriptor length */ iDescOffset += 2 + *(pcCurrent + 1); if (iDescOffset >= iDescLength/*psTempElementStream->iProgElDescLength*/) { memset(psDescAttr,0,sizeof(DescAttr)); DEBUG_PRINT("Did not find descriptor/n"); return PMT_NOT_FOUND; } pcCurrent = (char*)(pcRawDesc/*psTempElementStream->pcProgElDesc*/ + iDescOffset); iTempDescIdx += 1; } switch (psDescAttr->eParam) { case PMT_PRIVATE_DESCRIPTOR_TAG: { psDescAttr->uAttr.iDescTag = pcCurrent[0]; break; } case PMT_PRIVATE_DESCRIPTOR_PAYLOAD: { psDescAttr->uAttr.sPayload.pcPayload = pcCurrent + 2; psDescAttr->uAttr.sPayload.iPayloadLength = pcCurrent[1]; break; } } return PMT_OK;}
开发者ID:iourigordon,项目名称:soft_dev,代码行数:74,
示例26: Java_org_ebookdroid_droids_djvu_codec_DjvuContext_createextern "C" jlong Java_org_ebookdroid_droids_djvu_codec_DjvuContext_create(JNIEnv *env, jclass cls){ ddjvu_context_t* context = ddjvu_context_create(DJVU_DROID); DEBUG_PRINT("Creating context: %x", context); return (jlong) context;}
开发者ID:JMQCode,项目名称:iBooks,代码行数:6,
示例27: Java_org_ebookdroid_droids_djvu_codec_DjvuPage_renderPageBitmapextern "C" jboolean Java_org_ebookdroid_droids_djvu_codec_DjvuPage_renderPageBitmap(JNIEnv *env, jclass cls, jlong pageHangle, jint targetWidth, jint targetHeight, jfloat pageSliceX, jfloat pageSliceY, jfloat pageSliceWidth, jfloat pageSliceHeight, jobject bitmap, jint rendermode){//#ifdef USE_JNI_BITMAP_API DEBUG_WRITE("Rendering page bitmap"); AndroidBitmapInfo info; void *pixels; int ret; if ((ret = NativeBitmap_getInfo(env, bitmap, &info)) < 0) { DEBUG_PRINT("AndroidBitmap_getInfo() failed ! error=%d", ret); return 0; } DEBUG_WRITE("Checking format");// if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {// DEBUG_WRITE("Bitmap format is not RGBA_8888 !");// return 0;// } if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) { DEBUG_WRITE("Bitmap format is not RGB_565 !"); return 0; } DEBUG_WRITE("locking pixels"); if ((ret = NativeBitmap_lockPixels(env, bitmap, &pixels)) < 0) { DEBUG_PRINT("AndroidBitmap_lockPixels() failed ! error=%d", ret); return 0; } ddjvu_page_t* page = (ddjvu_page_t*) ((pageHangle)); ddjvu_rect_t pageRect; pageRect.x = 0; pageRect.y = 0; pageRect.w = targetWidth / pageSliceWidth; pageRect.h = targetHeight / pageSliceHeight; ddjvu_rect_t targetRect; targetRect.x = pageSliceX * targetWidth / pageSliceWidth; targetRect.y = pageSliceY * targetHeight / pageSliceHeight; targetRect.w = targetWidth; targetRect.h = targetHeight; unsigned int masks[] = { 0xF800, 0x07E0, 0x001F }; ddjvu_format_t* pixelFormat = ddjvu_format_create(DDJVU_FORMAT_RGBMASK16, 3, masks);// unsigned int masks[] = {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}; // ddjvu_format_t* pixelFormat = ddjvu_format_create(DDJVU_FORMAT_RGBMASK32, 4, masks); ddjvu_format_set_row_order(pixelFormat, TRUE); ddjvu_format_set_y_direction(pixelFormat, TRUE);// jboolean result = ddjvu_page_render(page, DDJVU_RENDER_COLOR, &pageRect, &targetRect, pixelFormat, targetWidth * 4, (char*)pixels); jboolean result = ddjvu_page_render(page, (ddjvu_render_mode_t) rendermode, &pageRect, &targetRect, pixelFormat, targetWidth * 2, (char*) pixels); ddjvu_format_release(pixelFormat); NativeBitmap_unlockPixels(env, bitmap); return result;//#else// DEBUG_WRITE("Rendering page bitmap not implemented");// return 0;//#endif}
开发者ID:JMQCode,项目名称:iBooks,代码行数:74,
示例28: SN_gams_solveint SN_gams_solve(unsigned iter, optHandle_t Optr, char* sysdir, char* model, const char* base_name, SolverOptions* options, SN_GAMS_gdx* gdx_data){ assert(gdx_data); SN_GAMS_NM_gdx* mat_for_gdx = gdx_data->mat_for_gdx; SN_GAMS_NV_gdx* vec_for_gdx = gdx_data->vec_for_gdx; SN_GAMS_NV_gdx* vec_from_gdx = gdx_data->vec_from_gdx; char msg[GMS_SSSIZE]; int status; gamsxHandle_t Gptr = NULL; idxHandle_t Xptr = NULL; gmoHandle_t gmoPtr = NULL; double infos[4] = {0.}; /* Create objects */ DEBUG_PRINT("FC3D_AVI_GAMS :: creating gamsx object/n"); if (! gamsxCreateD (&Gptr, sysdir, msg, sizeof(msg))) { fprintf(stderr, "Could not create gamsx object: %s/n", msg); return 1; } DEBUG_PRINT("FC3D_AVI_GAMS :: creating gdx object/n"); if (! idxCreateD (&Xptr, sysdir, msg, sizeof(msg))) { fprintf(stderr, "Could not create gdx object: %s/n", msg); return 1; } DEBUG_PRINT("FC3D_AVI_GAMS :: creating gmo object/n"); if (! gmoCreateD (&gmoPtr, sysdir, msg, sizeof(msg))) { fprintf(stderr, "Could not create gmo object: %s/n", msg); return 1; } /* create input and output gdx names*/ char gdxFileName[GMS_SSSIZE]; char solFileName[GMS_SSSIZE];// char paramFileName[GMS_SSSIZE]; strncpy(gdxFileName, base_name, sizeof(gdxFileName)); strncpy(solFileName, base_name, sizeof(solFileName)); strncat(solFileName, "_sol", sizeof(solFileName) - strlen(solFileName) - 1); strncat(gdxFileName, ".gdx", sizeof(gdxFileName) - strlen(gdxFileName) - 1); strncat(solFileName, ".gdx", sizeof(solFileName) - strlen(solFileName) - 1);// strncat(paramFileName, ".txt", sizeof(paramFileName)); /* XXX ParmFile is not a string option */// optSetStrStr(Optr, "ParmFile", paramFileName);// setDashedOptions("filename", gdxFileName, paramFileName); optSetStrStr(Optr, "User1", gdxFileName); optSetStrStr(Optr, "User2", solFileName); idxOpenWrite(Xptr, gdxFileName, "Siconos/Numerics NM_to_GDX", &status); if (status) idxerrorR(status, "idxOpenWrite"); DEBUG_PRINT("FC3D_AVI_GAMS :: fc3d_avi-condensed.gdx opened/n"); while (mat_for_gdx) { char mat_descr[30]; assert(mat_for_gdx->name); assert(mat_for_gdx->mat); snprintf(mat_descr, sizeof(mat_descr), "%s matrix", mat_for_gdx->name); if ((status=NM_to_GDX(Xptr, mat_for_gdx->name, mat_descr, mat_for_gdx->mat))) { fprintf(stderr, "Model data for matrix %s not written/n", mat_for_gdx->name); infos[1] = (double)-ETERMINATE; goto fail; } DEBUG_PRINTF("GAMSlink :: %s matrix written/n", mat_for_gdx->name); mat_for_gdx = mat_for_gdx->next; } while (vec_for_gdx) { char vec_descr[30]; assert(vec_for_gdx->name); assert(vec_for_gdx->vec); assert(vec_for_gdx->size > 0); snprintf(vec_descr, sizeof(vec_descr), "%s vector", vec_for_gdx->name); if ((status=NV_to_GDX(Xptr, vec_for_gdx->name, vec_descr, vec_for_gdx->vec, vec_for_gdx->size))) { fprintf(stderr, "Model data for vector %s not written/n", vec_for_gdx->name); infos[1] = (double)-ETERMINATE; goto fail; } DEBUG_PRINTF("FC3D_AVI_GAMS :: %s vector written/n", vec_for_gdx->name); vec_for_gdx = vec_for_gdx->next; } if (idxClose(Xptr)) idxerrorR(idxGetLastError(Xptr), "idxClose");// cp(gdxFileName, "fc3d_avi-condensed.gdx"); if ((status=CallGams(Gptr, Optr, sysdir, model))) { fprintf(stderr, "Call to GAMS failed/n"); infos[1] = (double)-ETERMINATE;//.........这里部分代码省略.........
开发者ID:xhub,项目名称:siconos,代码行数:101,
示例29: search_861_modestatic uint8_t search_861_mode(sync_info_type *p_sync_info){ int i; uint8_t detected_video_idx = SI_VIDEO_MODE_NON_STD; int16_t range; enum { not_found = 0, found_not_exact = 1, found_exact = 2 } search_result = not_found; for(i=0; VideoModeTable[i].Vic4x3 || VideoModeTable[i].Vic16x9; i++) { const videoMode_t *p_video_table = &VideoModeTable[i]; bool_t interlaced = p_sync_info->Interlaced; uint16_t total_V_lines_measured = (interlaced ? (p_sync_info->TotalLines * 2) : p_sync_info->TotalLines); // check progressive/interlaced if(interlaced != p_video_table->Interlaced) continue; // check number of lines if(ABS_DIFF(total_V_lines_measured, p_video_table->Total.V) > LINES_TOLERANCE) continue; // check number of clocks per line (it works for all possible replications) if(ABS_DIFF(p_sync_info->ClocksPerLine, p_video_table->Total.H) > PIXELS_TOLERANCE) continue; // check Pixel Freq (in 10kHz units)// if(ABS_DIFF(p_sync_info->PixelFreq, p_video_table->PixClk) > FPIX_TOLERANCE) // tolerance based on fixed bandwidth if (0 != ABS_DIFF(p_sync_info->PixelFreq, p_video_table->PixClk)) // tolerance based on dynamic bandwidth (fixed ratio) { range = p_video_table->PixClk / ABS_DIFF(p_sync_info->PixelFreq, p_video_table->PixClk); if( (range) < FPIX_TOLERANCE_RANGE) // per PLL range continue; }#if 0 // enable it for mode search tuning DEBUG_PRINT(MSG_STAT, "Index in table: %d, interlaced: %d, range: %d", (int) i, (int) interlaced, (int)range); DEBUG_PRINT(MSG_STAT, "Pixel Freq detected: %d, Pixel Freq in video table: %d", (int) p_sync_info->PixelFreq, (int) p_video_table->PixClk); DEBUG_PRINT(MSG_STAT, "clock per lines detected: %d, lines detected: %d", (int) p_sync_info->ClocksPerLine, (int) total_V_lines_measured); DEBUG_PRINT(MSG_STAT, "clock per lines in video table: %d, lines in video table: %d/n", (int) p_video_table->Total.H, (int) p_video_table->Total.V);#endif // if all previous tests passed, then we found at least one mode even polarity is mismatched if(search_result == not_found) { search_result = found_not_exact; detected_video_idx = i; } // check exact number of lines if(ABS_DIFF(total_V_lines_measured, p_video_table->Total.V) > 1) continue; // check polarities if( (p_sync_info->HPol == p_video_table->HPol) && (p_sync_info->VPol == p_video_table->VPol) ) { // if all previous checks passed search_result = found_exact; detected_video_idx = i; break; } } switch(search_result) { case not_found: break; case found_exact: break; case found_not_exact: DEBUG_PRINT(MSG_STAT, ("RX: Warning: not exact video mode found/n")); break; } return detected_video_idx;}
开发者ID:xinyun,项目名称:kernel,代码行数:100,
注:本文中的DEBUG_PRINT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DEBUG_PRINTF函数代码示例 C++ DEBUG_OUTPUT函数代码示例 |