您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DBG2函数代码示例

51自学网 2021-06-01 20:17:50
  C++
这篇教程C++ DBG2函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DBG2函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG2函数的具体用法?C++ DBG2怎么用?C++ DBG2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DBG2函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: starter_klips_init

bool starter_klips_init(void){	struct stat stb;	if (stat(PROC_KLIPS, &stb) != 0)	{		/* ipsec module makes the pf_key proc interface visible */		if (stat(PROC_MODULES, &stb) == 0)		{			ignore_result(system("modprobe -qv ipsec"));		}		/* now test again */		if (stat(PROC_KLIPS, &stb) != 0)		{			DBG2(DBG_APP, "kernel appears to lack the KLIPS IPsec stack");			return FALSE;		}	}	/* load crypto algorithm modules */	ignore_result(system("modprobe -qv ipsec_aes"));	ignore_result(system("modprobe -qv ipsec_blowfish"));	ignore_result(system("modprobe -qv ipsec_sha2"));	DBG2(DBG_APP, "found KLIPS IPsec stack");	return TRUE;}
开发者ID:alanrevans,项目名称:strongswan,代码行数:28,


示例2: ar9002_hw_setup_calibration

static void ar9002_hw_setup_calibration(struct ath_hw *ah,					struct ath9k_cal_list *currCal){	REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0),		      AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX,		      currCal->calData->calCountMax);	switch (currCal->calData->calType) {	case IQ_MISMATCH_CAL:		REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);		DBG2("ath9k: "			"starting IQ Mismatch Calibration/n");		break;	case ADC_GAIN_CAL:		REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN);		DBG2("ath9k: "			"starting ADC Gain Calibration/n");		break;	case ADC_DC_CAL:		REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER);		DBG2("ath9k: "			"starting ADC DC Calibration/n");		break;	}	REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0),		    AR_PHY_TIMING_CTRL4_DO_CAL);}
开发者ID:42wim,项目名称:ipxe,代码行数:28,


示例3: DBG3

GList* DataStorage::lookup_network(const gchar *a_object_path) {	GList *item = NULL;	DBG3();	if(a_object_path == NULL) {		ERR("no object_path.");		return NULL;	}	if(m_list_networks == NULL) {		DBG2("network not found, list is empty.");		return NULL;	}	item = g_list_find_custom(m_list_networks, a_object_path, compare_object_path);	if(item != NULL) {		DBG2("network found");		return item;	}	else {		DBG2("network not found.");	}	return NULL;}
开发者ID:roland-wilhelm,项目名称:vhd,代码行数:31,


示例4: vdds_cleanup_hybrid_res

/* * vdds_cleanup_hybrid_res -- Cleanup Hybrid resource. */voidvdds_cleanup_hybrid_res(void *arg){	vnet_t *vnetp = arg;	vnet_dds_info_t *vdds = &vnetp->vdds_info;	DBG1(vdds, "Hybrid device cleanup...");	mutex_enter(&vdds->lock);	if (vdds->task_flags == VNET_DDS_TASK_ADD_SHARE) {		/*		 * Task for ADD_SHARE is pending, simply		 * cleanup the flags, the task will quit without		 * any changes.		 */		vdds->task_flags = 0;		DBG2(vdds, "Task for ADD is pending, clean flags only");	} else if ((vdds->hio_dip != NULL) && (vdds->task_flags == 0)) {		/*		 * There is no task pending and a hybrid device		 * is present, so dispatch a task to release the share.		 */		vdds->task_flags = VNET_DDS_TASK_REL_SHARE;		(void) ddi_taskq_dispatch(vdds->dds_taskqp,		    vdds_process_dds_msg_task, vnetp, DDI_NOSLEEP);		DBG2(vdds, "Dispatched a task to destroy HIO device");	}	/*	 * Other possible cases include either DEL_SHARE or	 * REL_SHARE as pending. In that case, there is nothing	 * to do as a task is already pending to do the cleanup.	 */	mutex_exit(&vdds->lock);	DBG1(vdds, "Hybrid device cleanup complete");}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:37,


示例5: channel_ust_disable

/* * Disable UST channel for session and domain. */int channel_ust_disable(struct ltt_ust_session *usess,		struct ltt_ust_channel *uchan){	int ret = LTTNG_OK;	assert(usess);	assert(uchan);	/* Already disabled */	if (uchan->enabled == 0) {		DBG2("Channel UST %s already disabled", uchan->name);		goto end;	}	DBG2("Channel %s being disabled in UST global domain", uchan->name);	/* Disable channel for global domain */	ret = ust_app_disable_channel_glb(usess, uchan);	if (ret < 0 && ret != -LTTNG_UST_ERR_EXIST) {		ret = LTTNG_ERR_UST_CHAN_DISABLE_FAIL;		goto error;	}	uchan->enabled = 0;	DBG2("Channel %s disabled successfully", uchan->name);	return LTTNG_OK;end:error:	return ret;}
开发者ID:abusque,项目名称:lttng-tools,代码行数:35,


示例6: strb_imm

void strb_imm(uint8_t rt, uint8_t rn, uint32_t imm32,		bool index, bool add, bool wback) {	DBG2("strb r%02d, [r%02d, #%08x]/n", rt, rn, imm32);	uint32_t rn_val = CORE_reg_read(rn);	uint32_t rt_val = CORE_reg_read(rt);	uint32_t offset_addr;	if (add) {		offset_addr = rn_val + imm32;	} else {		offset_addr = rn_val - imm32;	}	uint32_t address;	if (index) {		address = offset_addr;	} else {		address = rn_val;	}	DBG2("address: %08x/n", address);	write_byte(address, rt_val & 0xff);	if (wback) {		CORE_reg_write(rn, offset_addr);	}	DBG2("strb_imm ran/n");}
开发者ID:lab11,项目名称:M-ulator,代码行数:31,


示例7: channel_ust_enable

/* * Enable UST channel for session and domain. */int channel_ust_enable(struct ltt_ust_session *usess,		struct ltt_ust_channel *uchan){	int ret = LTTNG_OK;	assert(usess);	assert(uchan);	/* If already enabled, everything is OK */	if (uchan->enabled) {		DBG3("Channel %s already enabled. Skipping", uchan->name);		ret = LTTNG_ERR_UST_CHAN_EXIST;		goto end;	}	DBG2("Channel %s being enabled in UST domain", uchan->name);	/*	 * Enable channel for UST global domain on all applications. Ignore return	 * value here since whatever error we got, it means that the channel was	 * not created on one or many registered applications and we can not report	 * this to the user yet. However, at this stage, the channel was	 * successfully created on the session daemon side so the enable-channel	 * command is a success.	 */	(void) ust_app_enable_channel_glb(usess, uchan);	uchan->enabled = 1;	DBG2("Channel %s enabled successfully", uchan->name);end:	return ret;}
开发者ID:abusque,项目名称:lttng-tools,代码行数:36,


示例8: ar9003_hw_setup_calibration

static void ar9003_hw_setup_calibration(struct ath_hw *ah,					struct ath9k_cal_list *currCal){	/* Select calibration to run */	switch (currCal->calData->calType) {	case IQ_MISMATCH_CAL:		/*		 * Start calibration with		 * 2^(INIT_IQCAL_LOG_COUNT_MAX+1) samples		 */		REG_RMW_FIELD(ah, AR_PHY_TIMING4,			      AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX,		currCal->calData->calCountMax);		REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);		DBG2("ath9k: "			"starting IQ Mismatch Calibration/n");		/* Kick-off cal */		REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);		break;	case TEMP_COMP_CAL:		REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_THERM,			      AR_PHY_65NM_CH0_THERM_LOCAL, 1);		REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_THERM,			      AR_PHY_65NM_CH0_THERM_START, 1);		DBG2("ath9k: "			"starting Temperature Compensation Calibration/n");		break;	}}
开发者ID:42wim,项目名称:ipxe,代码行数:32,


示例9: asn1_parser_create

/** * Load a generic private key from an ASN.1 encoded blob */static private_key_t *parse_private_key(chunk_t blob){	asn1_parser_t *parser;	chunk_t object, params = chunk_empty;	int objectID;	private_key_t *key = NULL;	key_type_t type = KEY_ANY;	parser = asn1_parser_create(pkinfoObjects, blob);	parser->set_flags(parser, FALSE, TRUE);	while (parser->iterate(parser, &objectID, &object))	{		switch (objectID)		{			case PKINFO_PRIVATE_KEY_ALGORITHM:			{				int oid = asn1_parse_algorithmIdentifier(object,									parser->get_level(parser) + 1, &params);				switch (oid)				{					case OID_RSA_ENCRYPTION:						type = KEY_RSA;						break;					case OID_EC_PUBLICKEY:						type = KEY_ECDSA;						break;					default:						/* key type not supported */						goto end;				}				break;			}			case PKINFO_PRIVATE_KEY:			{				DBG2(DBG_ASN, "-- > --");				if (params.ptr)				{					key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY,											 type, BUILD_BLOB_ALGID_PARAMS,											 params, BUILD_BLOB_ASN1_DER,											 object, BUILD_END);				}				else				{					key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY,											 type, BUILD_BLOB_ASN1_DER, object,											 BUILD_END);				}				DBG2(DBG_ASN, "-- < --");				break;			}		}	}end:	parser->destroy(parser);	return key;}
开发者ID:21superman,项目名称:strongswan,代码行数:63,


示例10: CORE_reg_write

EXPORT void CORE_reg_write(int r, uint32_t val) {	assert(r >= 0 && r < 16 && "CORE_reg_write");	if (r == SP_REG) {		SW(physical_sp_p, val & 0xfffffffc);	} else if (r == LR_REG) {		SW(&physical_lr, val);	} else if (r == PC_REG) {		DBG2("Writing %08x to PC/n", val & 0xfffffffe);#ifdef NO_PIPELINE		pipeline_flush_exception_handler(val & 0xfffffffe);#else		if (state_is_debugging()) {			DBG1("PC write + debugging --> flush/n");			state_pipeline_flush(val & 0xfffffffe);		} else {			// Only flush if the new PC differs from predicted in pipeline:			if (((SR(&if_id_PC) & 0xfffffffe) - 4) == (val & 0xfffffffe)) {				DBG2("Predicted PC correctly (%08x)/n", val);			} else {				state_pipeline_flush(val & 0xfffffffe);				DBG2("Predicted PC incorrectly/n");				DBG2("Pred: %08x, val: %08x/n", SR(&if_id_PC), val);			}		}#endif	}	else {		SW(&(physical_reg[r]), val);	}}
开发者ID:hoangt,项目名称:M-ulator,代码行数:30,


示例11: starter_netkey_init

bool starter_netkey_init(void){	struct stat stb;	if (stat(PROC_NETKEY, &stb) != 0)	{		/* af_key module makes the netkey proc interface visible */		if (stat(PROC_MODULES, &stb) == 0)		{			ignore_result(system("modprobe -qv af_key"));		}		/* now test again */		if (stat(PROC_NETKEY, &stb) != 0)		{			DBG2(DBG_APP, "kernel appears to lack the native netkey IPsec stack");			return FALSE;		}	}	/* make sure that all required IPsec modules are loaded */	if (stat(PROC_MODULES, &stb) == 0)	{		ignore_result(system("modprobe -qv ah4"));		ignore_result(system("modprobe -qv esp4"));		ignore_result(system("modprobe -qv ipcomp"));		ignore_result(system("modprobe -qv xfrm4_tunnel"));		ignore_result(system("modprobe -qv xfrm_user"));	}	DBG2(DBG_APP, "found netkey IPsec stack");	return TRUE;}
开发者ID:agimsn,项目名称:strongswan,代码行数:33,


示例12: set_Arm

void set_Arm (unsigned char mode){#ifdef CMM_ARM_EXPERIMENT	unsigned long cur_pos;	unsigned char old_mode;	unsigned char pct_deployed;	get_ArmPosition(&cur_pos, &old_mode);	if (mode == old_mode) return;	if (old_mode != ARM_STOP)	{		if (cur_pos != arm_pos)		{			pct_deployed = cur_pos / ARM_STROKE_PCT;#ifdef ARM_POS_DEBUG			DBG("Arm moved ");			if (cur_pos > arm_pos)				DBG2("+%lu", cur_pos - arm_pos);			else				DBG2("-%lu", arm_pos - cur_pos);			DBG3(" to %lu (%lu)/n", cur_pos, pct_deployed);#endif			arm_pos = cur_pos;		}	}	else	{		pct_deployed = cur_pos / ARM_STROKE_PCT;	}	if (mode != ARM_STOP) gettimestamp(&arm_start);#endif	switch (mode) {	default:	case ARM_STOP:		ARM(LAT) &= ~(ARM_UPDOWN_MASK | ARM_ONOFF_MASK);		break;	case ARM_UP:		ARM(LAT) &= ~ARM_UPDOWN_MASK;		ARM(LAT) |=  ARM_ONOFF_MASK;		break;	case ARM_DOWN:		ARM(LAT) |= ARM_UPDOWN_MASK;		ARM(LAT) |= ARM_ONOFF_MASK;		break;	}#ifdef CMM_ARM_EXPERIMENT	// % deployed in lower bits, mode in upper bits	eventlog_track(EVENTLOG_ARM, (((uint16_t)pct_deployed) << 8) | mode);#else	eventlog_track(EVENTLOG_ARM, mode);#endif}
开发者ID:red13dotnet,项目名称:catgenius-deblobbed,代码行数:57,


示例13: pts_dh_group_probe

/** * Described in header. */bool pts_dh_group_probe(pts_dh_group_t *dh_groups){	enumerator_t *enumerator;	diffie_hellman_group_t dh_group;	const char *plugin_name;	char format1[] = "  %s PTS DH group %N[%s] available";	char format2[] = "  %s PTS DH group %N not available";	*dh_groups = PTS_DH_GROUP_NONE;	enumerator = lib->crypto->create_dh_enumerator(lib->crypto);	while (enumerator->enumerate(enumerator, &dh_group, &plugin_name))	{		if (dh_group == MODP_1024_BIT)		{			*dh_groups |= PTS_DH_GROUP_IKE2;			DBG2(DBG_PTS, format1, "optional ", diffie_hellman_group_names,									dh_group, plugin_name);		}		else if (dh_group == MODP_1536_BIT)		{			*dh_groups |= PTS_DH_GROUP_IKE5;			DBG2(DBG_PTS, format1, "optional ", diffie_hellman_group_names,									dh_group, plugin_name);		}		else if (dh_group == MODP_2048_BIT)		{			*dh_groups |= PTS_DH_GROUP_IKE14;			DBG2(DBG_PTS, format1, "optional ", diffie_hellman_group_names,									dh_group, plugin_name);		}		else if (dh_group == ECP_256_BIT)		{			*dh_groups |= PTS_DH_GROUP_IKE19;			DBG2(DBG_PTS, format1, "mandatory", diffie_hellman_group_names,									dh_group, plugin_name);		}		else if (dh_group == ECP_384_BIT)		{			*dh_groups |= PTS_DH_GROUP_IKE20;			DBG2(DBG_PTS, format1, "optional ", diffie_hellman_group_names,									dh_group, plugin_name);		}	}	enumerator->destroy(enumerator);	if (*dh_groups & PTS_DH_GROUP_IKE19)	{		return TRUE;	}	else	{		DBG1(DBG_PTS, format2, "mandatory", diffie_hellman_group_names,											ECP_256_BIT);	}	return FALSE;}
开发者ID:JingLinWu,项目名称:os-strongswan,代码行数:60,


示例14: asn1_length

/* * Defined in header. */size_t asn1_length(chunk_t *blob){	u_char n;	size_t len;	if (blob->len < 2)	{		DBG2(DBG_ASN, "insufficient number of octets to parse ASN.1 length");		return ASN1_INVALID_LENGTH;	}	/* read length field, skip tag and length */	n = blob->ptr[1];	blob->ptr += 2;	blob->len -= 2;	if ((n & 0x80) == 0)	{	/* single length octet */		if (n > blob->len)		{			DBG2(DBG_ASN, "length is larger than remaining blob size");			return ASN1_INVALID_LENGTH;		}		return n;	}	/* composite length, determine number of length octets */	n &= 0x7f;	if (n == 0 || n > blob->len)	{		DBG2(DBG_ASN, "number of length octets invalid");		return ASN1_INVALID_LENGTH;	}	if (n > sizeof(len))	{		DBG2(DBG_ASN, "number of length octets is larger than limit of"			 " %d octets", (int)sizeof(len));		return ASN1_INVALID_LENGTH;	}	len = 0;	while (n-- > 0)	{		len = 256*len + *blob->ptr++;		blob->len--;	}	if (len > blob->len)	{		DBG2(DBG_ASN, "length is larger than remaining blob size");		return ASN1_INVALID_LENGTH;	}	return len;}
开发者ID:hertus,项目名称:strongswan,代码行数:59,


示例15: tea_thread_stop

static void tea_thread_stop(int tid){  THREAD_WORK *tw;  int r;  /* wait until we have exclusive access right on ttable */  DBG("[tea] Thread %d killing scheduled.", tid);  pthreadex_lock_get_exclusive_n(&ttable_lock, "kill-thread");  /* going to kill thread */  tw = ttable[tid];  pthreadex_lock_release();  if(tw != NULL)  {    DBG("[tea] Killing thread %d.", tid);    /* consider it dead */    ttable[tid] = NULL;    /* allow thread to do the cleanup */    DBG2("[tea] Approve cleanup...");    pthreadex_flag_up(&(tw->cleanup_do));    while((r = pthread_cancel(tw->pthread_id)) != 0 && errno == EINTR)    {      DBG("[tea] Cancel EINTR; repeating pthread_cancel() on %d", tid);      errno = 0;    }    if(r != 0)      ERR_ERRNO("[tea] Cannot cancel thread %d", tid);    /* kill thread */    while((r = pthread_detach(tw->pthread_id)) != 0 && errno == EINTR)    {      DBG("[tea] Detach EINTR; repeating pthread_detach() on  %d", tid);      errno = 0;    }    if(r != 0)      ERR_ERRNO("[tea] Cannot detach thread %d", tid);    /* wait cleanup finishes */    DBG2("[tea] Wait cleanup termination...");    pthreadex_flag_wait(&(tw->cleanup_done));    DBG("[tea] THREAD %d KILLED!", tid);    /* destroy flags && free mem */    pthreadex_flag_destroy(&(tw->mwaiting));    pthreadex_flag_destroy(&(tw->cleanup_do));    pthreadex_flag_destroy(&(tw->cleanup_done));    free(tw);  } else    ERR("[tea] Thread %d does not exist or died voluntarely.", tid);}
开发者ID:killabytenow,项目名称:dosis,代码行数:55,


示例16: asn1_parser_create

/** * Load a generic public key from an ASN.1 encoded blob */static public_key_t *parse_public_key(chunk_t blob){	asn1_parser_t *parser;	chunk_t object;	int objectID;	public_key_t *key = NULL;	key_type_t type = KEY_ANY;	parser = asn1_parser_create(pkinfoObjects, blob);	while (parser->iterate(parser, &objectID, &object))	{		switch (objectID)		{			case PKINFO_SUBJECT_PUBLIC_KEY_ALGORITHM:			{				int oid = asn1_parse_algorithmIdentifier(object,										parser->get_level(parser)+1, NULL);				if (oid == OID_RSA_ENCRYPTION || oid == OID_RSAES_OAEP)				{					type = KEY_RSA;				}				else if (oid == OID_EC_PUBLICKEY)				{					/* we need the whole subjectPublicKeyInfo for EC public keys */					key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY,								KEY_ECDSA, BUILD_BLOB_ASN1_DER, blob, BUILD_END);					goto end;				}				else				{					/* key type not supported */					goto end;				}				break;			}			case PKINFO_SUBJECT_PUBLIC_KEY:				if (object.len > 0 && *object.ptr == 0x00)				{					/* skip initial bit string octet defining 0 unused bits */					object = chunk_skip(object, 1);				}				DBG2(DBG_ASN, "-- > --");				key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, type,										 BUILD_BLOB_ASN1_DER, object, BUILD_END);				DBG2(DBG_ASN, "-- < --");				break;		}	}end:	parser->destroy(parser);	return key;}
开发者ID:alanrevans,项目名称:strongswan,代码行数:58,


示例17: extract_attributes

/** * Extract X.501 attributes */void extract_attributes(pkcs7_t *pkcs7, scep_attributes_t *attrs){	pkcs9_t *attributes = pkcs7->get_attributes(pkcs7);	chunk_t attr;	attr = attributes->get_attribute(attributes, OID_PKI_MESSAGE_TYPE);	if (attr.ptr)	{		scep_msg_t m;		for (m = SCEP_CertRep_MSG; m < SCEP_Unknown_MSG; m++)		{			if (strncmp(msgType_values[m], attr.ptr, attr.len) == 0)			{				attrs->msgType = m;			}		}		DBG2(DBG_APP, "messageType:  %s", msgType_names[attrs->msgType]);	}	attr = attributes->get_attribute(attributes, OID_PKI_STATUS);	if (attr.ptr)	{		pkiStatus_t s;		for (s = SCEP_SUCCESS; s < SCEP_UNKNOWN; s++)		{			if (strncmp(pkiStatus_values[s], attr.ptr, attr.len) == 0)			{				attrs->pkiStatus = s;			}		}		DBG2(DBG_APP, "pkiStatus:    %s", pkiStatus_names[attrs->pkiStatus]);	}	attr = attributes->get_attribute(attributes, OID_PKI_FAIL_INFO);	if (attr.ptr)	{		if (attr.len == 1 && *attr.ptr >= '0' && *attr.ptr <= '4')		{			attrs->failInfo = (failInfo_t)(*attr.ptr - '0');		}		if (attrs->failInfo != SCEP_unknown_REASON)		{			DBG1(DBG_APP, "failInfo:     %s", failInfo_reasons[attrs->failInfo]);		}	}	attrs->senderNonce = attributes->get_attribute(attributes,											OID_PKI_SENDER_NONCE);	attrs->recipientNonce = attributes->get_attribute(attributes,											OID_PKI_RECIPIENT_NONCE);	attrs->transID = attributes->get_attribute(attributes,											OID_PKI_TRANS_ID);}
开发者ID:alanrevans,项目名称:strongswan,代码行数:55,


示例18: usbFunctionSetup

usbMsgLen_t usbFunctionSetup(uchar data[8]){    usbRequest_t    *rq = (void *)data;    static uchar    dataBuffer[4];  /* buffer must stay valid when usbFunctionSetup returns, therefore static */    uint8_t         msgLen = 0;     /* default for not implemented requests: return no data back to host */        DBG1(0x03, &rq->bRequest, 1);    DBG1(0x04, &rq->wValue.bytes[0], 2);        switch (rq->bRequest) {        case CUSTOM_RQ_ECHO:            dataBuffer[0] = rq->wValue.bytes[0];            dataBuffer[1] = rq->wValue.bytes[1];            dataBuffer[2] = rq->wIndex.bytes[0];            dataBuffer[3] = rq->wIndex.bytes[1];            msgLen = 4;            break;                case CUSTOM_RQ_SET_STATUS:            if(rq->wValue.bytes[0] & 1){    /* set LED */                led_on(LED_RED);            }else{                                          led_off(LED_RED);           /* clear LED */            }                        break;                    case CUSTOM_RQ_GET_STATUS:            dataBuffer[0] = (led_status(LED_RED) != 0);            msgLen = 1;                     /* tell the driver to send 1 byte */            break;                case CUSTOM_RQ_GET_TEMPERATURE:            sht1x_measure(SHT_CMD_MEASURE_TEMPERATURE, &dataBuffer[0]);            //sser_getWord(SHT_CMD_MEASURE_TEMPERATURE, &dataBuffer[0]);            msgLen = 2;            DBG2(0x05, &dataBuffer[0], 2);            break;        case CUSTOM_RQ_GET_HUMIDITY:            sht1x_measure(SHT_CMD_MEASURE_HUMIDITY, &dataBuffer[0]);            //sser_getWord(SHT_CMD_MEASURE_HUMIDITY, &dataBuffer[0]);            msgLen = 2;            DBG2(0x05, &dataBuffer[0], 2);            break;                    default:            break;    }    usbMsgPtr = dataBuffer;         /* tell the driver which data to return */    return msgLen;                  /* tell the driver lenght of data to send */}
开发者ID:baracudaz,项目名称:usb-sht,代码行数:51,


示例19: DBG2

void BuzzMDKHelper::SetInputChannels(char const *szMachine, bool bStereo) {	DBG2("(szMachine=%s,bStereo=%d)/n",szMachine,bStereo);/*	CMachine * pMachine = pmi->pCB->GetMachine(szMachine);	if (!pMachine)	{		// machine doesn't exist!		return;	}//	if (!(pMachine->cMachineInfo->Flags & MIF_MONO_TO_STEREO) )//	{//		// machine can't do stereo so leave this input channel as mono//		bStereo = false;//	}//	else	{		for (INPUTITERATOR i = Inputs.begin(); i != Inputs.end(); ++i)		{			if (i->strName.compare(szMachine) == 0)			{				i->bStereo = bStereo;				break;			}		}	}	// change from mono output to stereo output if this input is itself stereo	// and the machine (up until now) would've been mono-output	if (MachineWantsChannels==1)	{		SetOutputMode(bStereo);	}*/}
开发者ID:Buzztrax,项目名称:bml,代码行数:35,


示例20: usbSetInterrupt

void    usbSetInterrupt(uchar *data, uchar len){uchar       *p, i;#if USB_CFG_IMPLEMENT_HALT    if(usbTxLen1 == USBPID_STALL)        return;#endif#if 0   /* No runtime checks! Caller is responsible for valid data! */    if(len > 8) /* interrupt transfers are limited to 8 bytes */        len = 8;#endif    i = USBPID_DATA1;    if(usbTxPacketCnt1 & 1)        i = USBPID_DATA0;    if(usbTxLen1 & 0x10){       /* packet buffer was empty */        usbTxPacketCnt1++;    }else{        usbTxLen1 = USBPID_NAK; /* avoid sending incomplete interrupt data */    }    p = usbTxBuf1;    *p++ = i;    for(i=len;i--;)        *p++ = *data++;    usbCrc16Append(&usbTxBuf1[1], len);    usbTxLen1 = len + 4;    /* len must be given including sync byte */    DBG2(0x21, usbTxBuf1, len + 3);}
开发者ID:AlexeyMochalov,项目名称:RGBulb,代码行数:28,


示例21: add_ml_var

voidadd_ml_var(MLVars *ml_vars, mxArray *array, const char *vname){    _MLVar *node = mxMalloc(sizeof(_MLVar));    char *varName = mxMalloc(sizeof(char) * (strlen(vname)+1));	mxAssert(ml_vars, "NULL ML Variable list");    strcpy(varName, vname);    /* Make the new node */    node->_array = array;    node->_vname = varName;    node->_next = NULL;    DBG2(msg("add_new_ml_var: %s, node: %d/n",varName,node));    /* If the list is empty, this is the `base' */    if (ml_vars->_base == NULL)	ml_vars->_base = node;    /* If the list is not empty, link this to the end */    if (ml_vars->_end != NULL)	ml_vars->_end->_next = node;    /* Make this the end node */    ml_vars->_end = node;    /* Do bookkeeping */    ml_vars->_length++;    ml_vars->_current = node;}
开发者ID:OPENDAP,项目名称:loaddap,代码行数:32,


示例22: get_random_value

int get_random_value(unsigned char *data, int length){  static const char *random_device = "/dev/urandom";  int rv, fh, l;  DBG2("reading %d random bytes from %s", length, random_device);  fh = open(random_device, O_RDONLY);  if (fh == -1) {    set_error("open() failed: %s", strerror(errno));    return -1;  }  l = 0;  while (l < length) {    rv = read(fh, data + l, length - l);    if (rv <= 0) {      close(fh);      set_error("read() failed: %s", strerror(errno));      return -1;    }    l += rv;  }  close(fh);  DBG5("random-value[%d] = [%02x:%02x:%02x:...:%02x]", length, data[0],      data[1], data[2], data[length - 1]);  return 0;}
开发者ID:dirkx,项目名称:pam_pkcs11,代码行数:27,


示例23: pt_tls_write

/** * Prepend a PT-TLS header to a writer, send data, destroy writer */bool pt_tls_write(tls_socket_t *tls, pt_tls_message_type_t type,				  uint32_t identifier, chunk_t data){	bio_writer_t *writer;	chunk_t out;	ssize_t len;	len = PT_TLS_HEADER_LEN + data.len;	writer = bio_writer_create(len);	/* write PT-TLS header */	writer->write_uint8 (writer, 0);	writer->write_uint24(writer, 0);	writer->write_uint32(writer, type);	writer->write_uint32(writer, len);	writer->write_uint32(writer, identifier);	/* write PT-TLS body */	writer->write_data(writer, data);	DBG2(DBG_TNC, "sending PT-TLS message #%d of type '%N' (%d bytes)",				   identifier, pt_tls_message_type_names, type, len);	out = writer->get_buf(writer);	len = tls->write(tls, out.ptr, out.len);	writer->destroy(writer);	return len == out.len;}
开发者ID:FancyMariusz,项目名称:strongswan,代码行数:32,


示例24: ust_consumer_send_channel_to_ust

/* * Send channel previously received from the consumer to the UST tracer. * * On success return 0 else a negative value. */int ust_consumer_send_channel_to_ust(struct ust_app *app,		struct ust_app_session *ua_sess, struct ust_app_channel *channel){	int ret;	assert(app);	assert(ua_sess);	assert(channel);	assert(channel->obj);	DBG2("UST app send channel to sock %d pid %d (name: %s, key: %" PRIu64 ")",			app->sock, app->pid, channel->name, channel->tracing_channel_id);	/* Send stream to application. */	pthread_mutex_lock(&app->sock_lock);	ret = ustctl_send_channel_to_ust(app->sock, ua_sess->handle, channel->obj);	pthread_mutex_unlock(&app->sock_lock);	if (ret < 0) {		if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {			ERR("Error ustctl send channel %s to app pid: %d with ret %d",					channel->name, app->pid, ret);		} else {			DBG3("UST app send channel to ust failed. Application is dead.");		}		goto error;	}error:	return ret;}
开发者ID:Stratoscale,项目名称:lttng-tools,代码行数:35,


示例25: ust_consumer_send_stream_to_ust

/* * Send a given stream to UST tracer. * * On success return 0 else a negative value. */int ust_consumer_send_stream_to_ust(struct ust_app *app,		struct ust_app_channel *channel, struct ust_app_stream *stream){	int ret;	assert(app);	assert(stream);	assert(channel);	DBG2("UST consumer send stream to app %d", app->sock);	/* Relay stream to application. */	pthread_mutex_lock(&app->sock_lock);	ret = ustctl_send_stream_to_ust(app->sock, channel->obj, stream->obj);	pthread_mutex_unlock(&app->sock_lock);	if (ret < 0) {		if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {			ERR("ustctl send stream handle %d to app pid: %d with ret %d",					stream->obj->handle, app->pid, ret);		} else {			DBG3("UST app send stream to ust failed. Application is dead.");		}		goto error;	}	channel->handle = channel->obj->handle;error:	return ret;}
开发者ID:Stratoscale,项目名称:lttng-tools,代码行数:34,


示例26: timer_expired

/** * Handle expired timer * * @v timer		Retry timer */static void timer_expired ( struct retry_timer *timer ) {	int fail;	/* Stop timer without performing RTT calculations */	DBG2 ( "Timer %p stopped at time %ld on expiry/n",	       timer, currticks() );	assert ( timer->running );	list_del ( &timer->list );	timer->running = 0;	timer->count++;	/* Back off the timeout value */	timer->timeout <<= 1;	if ( timer->max_timeout == 0 ) /* 0 means "use default timeout" */		timer->max_timeout = DEFAULT_MAX_TIMEOUT;	if ( ( fail = ( timer->timeout > timer->max_timeout ) ) )		timer->timeout = timer->max_timeout;	DBG ( "Timer %p timeout backed off to %ld/n",	      timer, timer->timeout );	/* Call expiry callback */	timer->expired ( timer, fail );	ref_put ( timer->refcnt );}
开发者ID:3a9LL,项目名称:panda,代码行数:30,


示例27: fb_bg_get_xroot_pix_for_win

GdkPixmap *fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget){    Window win;    Window dummy;    Pixmap bgpix;    GdkPixmap *gbgpix;    int  width, height ;    int  border, depth, x, y ;    ENTER;    win =  GDK_WINDOW_XWINDOW(widget->window);     if (!XGetGeometry(bg->dpy, win, &dummy, &x, &y, &width, &height, &border, &depth)) {        DBG2("XGetGeometry failed/n");        RET(NULL);    }    XTranslateCoordinates(bg->dpy, win, bg->xroot, 0, 0, &x, &y, &dummy);    DBG("win=%x %dx%d%+d%+d/n", win, width, height, x, y);    gbgpix = gdk_pixmap_new(NULL, width, height, depth);    if (!gbgpix) {        ERR("gdk_pixmap_new failed/n");        RET(NULL);    }    bgpix =  gdk_x11_drawable_get_xid(gbgpix);    XSetTSOrigin(bg->dpy, bg->gc, -x, -y) ;    XFillRectangle(bg->dpy, bgpix, bg->gc, 0, 0, width, height);    RET(gbgpix);}
开发者ID:BackupTheBerlios,项目名称:fbpanel-svn,代码行数:28,


示例28: usbSetInterrupt

void    usbSetInterrupt(uchar *data, uchar len){uchar       *p, i;#if USB_CFG_IMPLEMENT_HALT    if(usbHalted1)        return;#endif    if(len > 8) /* interrupt transfers are limited to 8 bytes */        len = 8;    i = USBPID_DATA1;    if(usbTxPacketCnt1 & 1)        i = USBPID_DATA0;    if(usbTxLen1 < 0){      /* packet buffer was empty */        usbTxPacketCnt1++;    }else{        usbTxLen1 = -1;     /* avoid sending incomplete interrupt data */    }    p = usbTxBuf1;    *p++ = i;    for(i=len;i--;)        *p++ = *data++;    usbCrc16Append(&usbTxBuf1[1], len);    usbTxLen1 = len + 4;    /* len must be given including sync byte */#if DEBUG_LEVEL > 1    DBG2(0x21, usbTxBuf1, usbTxLen1-1);#else    DBG1(0x21, usbTxBuf1 + 1, 2);#endif}
开发者ID:unhold,项目名称:avr,代码行数:30,


示例29: usbBuildTxBlock

static void usbBuildTxBlock(void){uchar       wantLen, len, txLen, token;    wantLen = usbMsgLen;    if(wantLen > 8)        wantLen = 8;    usbMsgLen -= wantLen;    token = USBPID_DATA1;    if(usbMsgFlags & USB_FLG_TX_PACKET)        token = USBPID_DATA0;    usbMsgFlags++;    len = usbRead(usbTxBuf + 1, wantLen);    if(len <= 8){           /* valid data packet */        usbCrc16Append(usbTxBuf + 1, len);        txLen = len + 4;    /* length including sync byte */        if(len < 8)         /* a partial package identifies end of message */            usbMsgLen = 0xff;    }else{        token = USBPID_STALL;        txLen = 2;          /* length including sync byte */        usbMsgLen = 0xff;    }    usbTxBuf[0] = token;    usbTxLen = txLen;#if DEBUG_LEVEL > 1    DBG2(0x20, usbTxBuf, txLen-1);#else    DBG1(0x20, usbTxBuf + 1, 2);#endif}
开发者ID:unhold,项目名称:avr,代码行数:31,


示例30: vdds_mod_init

/* * vdds_mod_init -- one time initialization. */voidvdds_mod_init(void){	int i;	int rv;	uint64_t minor = 0;	/*	 * Try register one by one from niu_hsvc.	 */	for (i = 0; i < (sizeof (niu_hsvc) / sizeof (hsvc_info_t)); i++) {		rv = hsvc_register(&niu_hsvc[i], &minor);		if (rv == 0) {			if (minor == niu_hsvc[i].hsvc_minor) {				vdds_hv_hio_capable = B_TRUE;				niu_hsvc_index = i;				break;			} else {				(void) hsvc_unregister(&niu_hsvc[i]);			}		}	}	mutex_init(&vdds_dev_lock, NULL, MUTEX_DRIVER, NULL);	DBG2(NULL, "HV HIO capable=%d ver(%ld.%ld)", vdds_hv_hio_capable,	    (niu_hsvc_index == -1) ? 0 : niu_hsvc[niu_hsvc_index].hsvc_major,	    minor);}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:30,



注:本文中的DBG2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DBG3函数代码示例
C++ DBG1函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。