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

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

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

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

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

示例1: handle_lab

static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status){	DEB2(printk(KERN_INFO		"i2c-algo-pcf.o: lost arbitration (CSR 0x%02x)/n",		 *status));	/* Cleanup from LAB -- reset and enable ESO.	 * This resets the PCF8584; since we've lost the bus, no	 * further attempts should be made by callers to clean up	 * (no i2c_stop() etc.)	 */	set_pcf(adap, 1, I2C_PCF_PIN);	set_pcf(adap, 1, I2C_PCF_ESO);	/* We pause for a time period sufficient for any running	 * I2C transaction to complete -- the arbitration logic won't	 * work properly until the next START is seen.	 * It is assumed the bus driver or client has set a proper value.	 *	 * REVISIT: should probably use msleep instead of mdelay if we	 * know we can sleep.	 */	if (adap->lab_mdelay)		mdelay(adap->lab_mdelay);	DEB2(printk(KERN_INFO		"i2c-algo-pcf.o: reset LAB condition (CSR 0x%02x)/n",		get_pcf(adap, 1)));}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:29,


示例2: handle_lab

static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status){	DEB2(printk(KERN_INFO		"i2c-algo-pcf.o: lost arbitration (CSR 0x%02x)/n",		*status));	/*                                                                                                                                                                                          */	set_pcf(adap, 1, I2C_PCF_PIN);	set_pcf(adap, 1, I2C_PCF_ESO);	/*                                                                                                                                                                                                                                                                                                                                  */	if (adap->lab_mdelay)		mdelay(adap->lab_mdelay);	DEB2(printk(KERN_INFO		"i2c-algo-pcf.o: reset LAB condition (CSR 0x%02x)/n",		get_pcf(adap, 1)));}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:29,


示例3: iic_avalanche_init

/* Called when the module is loaded.  This function starts the * cascade of calls up through the heirarchy of i2c modules (i.e. up to the *  algorithm layer and into to the core layer) */static int __init iic_avalanche_init(void){	struct iic_avalanche *piic = &iic_avalanche_priv_data;	DEB2(printk(KERN_INFO "Initialize Avalanche IIC adapter module/n"));        iic_avalanche_priv_data.iic_clock = avalanche_get_vbus_freq(); /* Clock frequency on the peripheral bus */ 	iic_avalanche_data.data = (void *)piic;	init_waitqueue_head(&iic_wait);	if (iic_hw_resrc_init() == 0) {                DEB2(printk("calling add bus/n"));		if (i2c_avalanche_add_bus(&iic_avalanche_ops) < 0)			return -ENODEV;	} else {		return -ENODEV;	}	DEB2(printk(KERN_INFO " found device at %#x irq %d./n",		piic->iic_base, piic->iic_irq));	return 0;}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:31,


示例4: pcf_init_8584

/* * This should perform the 'PCF8584 initialization sequence' as described * in the Philips IC12 data book (1995, Aug 29). * There should be a 30 clock cycle wait after reset, I assume this * has been fulfilled. * There should be a delay at the end equal to the longest I2C message * to synchronize the BB-bit (in multimaster systems). How long is * this? I assume 1 second is always long enough. * * vdovikin: added detect code for PCF8584 */static int pcf_init_8584 (struct i2c_algo_pcf_data *adap){	unsigned char temp;	DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: PCF state 0x%02x/n",				get_pcf(adap, 1)));	/* S1=0x80: S0 selected, serial interface off */	set_pcf(adap, 1, I2C_PCF_PIN);	/*	 * check to see S1 now used as R/W ctrl -	 * PCF8584 does that when ESO is zero	 */	if (((temp = get_pcf(adap, 1)) & 0x7f) != (0)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S0 (0x%02x)./n", temp));		return -ENXIO; /* definitely not PCF8584 */	}	/* load own address in S0, effective address is (own << 1) */	i2c_outb(adap, get_own(adap));	/* check it's really written */	if ((temp = i2c_inb(adap)) != get_own(adap)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S0 (0x%02x)./n", temp));		return -ENXIO;	}	/* S1=0xA0, next byte in S2 */	set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1);	/* check to see S2 now selected */	if (((temp = get_pcf(adap, 1)) & 0x7f) != I2C_PCF_ES1) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S2 (0x%02x)./n", temp));		return -ENXIO;	}	/* load clock register S2 */	i2c_outb(adap, get_clock(adap));	/* check it's really written, the only 5 lowest bits does matter */	if (((temp = i2c_inb(adap)) & 0x1f) != get_clock(adap)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S2 (0x%02x)./n", temp));		return -ENXIO;	}	/* Enable serial interface, idle, S0 selected */	set_pcf(adap, 1, I2C_PCF_IDLE);	/* check to see PCF is really idled and we can access status register */	if ((temp = get_pcf(adap, 1)) != (I2C_PCF_PIN | I2C_PCF_BB)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S1` (0x%02x)./n", temp));		return -ENXIO;	}	printk(KERN_DEBUG "i2c-algo-pcf.o: detected and initialized PCF8584./n");	return 0;}
开发者ID:020gzh,项目名称:linux,代码行数:66,


示例5: pcf_init_8584

static int pcf_init_8584 (struct i2c_algo_pcf_data *adap){	unsigned char temp;	DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: PCF state 0x%02x/n",				get_pcf(adap, 1)));	/*                                            */	set_pcf(adap, 1, I2C_PCF_PIN);	/*                                                                                  */	if (((temp = get_pcf(adap, 1)) & 0x7f) != (0)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S0 (0x%02x)./n", temp));		return -ENXIO; /*                        */	}	/*                                                         */	i2c_outb(adap, get_own(adap));	/*                           */	if ((temp = i2c_inb(adap)) != get_own(adap)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S0 (0x%02x)./n", temp));		return -ENXIO;	}	/*                          */	set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1);	/*                              */	if (((temp = get_pcf(adap, 1)) & 0x7f) != I2C_PCF_ES1) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S2 (0x%02x)./n", temp));		return -ENXIO;	}	/*                        */	i2c_outb(adap, get_clock(adap));	/*                                                               */	if (((temp = i2c_inb(adap)) & 0x1f) != get_clock(adap)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S2 (0x%02x)./n", temp));		return -ENXIO;	}	/*                                            */	set_pcf(adap, 1, I2C_PCF_IDLE);	/*                                                                    */	if ((temp = get_pcf(adap, 1)) != (I2C_PCF_PIN | I2C_PCF_BB)) {		DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S1` (0x%02x)./n", temp));		return -ENXIO;	}	printk(KERN_DEBUG "i2c-algo-pcf.o: detected and initialized PCF8584./n");	return 0;}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:55,


示例6: mlib_read_mthd

static intmlib_read_mthd (mlib_desc * desc){  char sig[5];  unsigned char hi, lo;  int len;  if (!mlib_chkdesc (desc))    return 0;  if (!mlib_rdstr (desc, sig, 4))    return 0;  if (strcmp (sig, "MThd"))    {      mlib_seterr ("Invalid header signature (!= MThd)");      return 0;    }  if (mlib_rdint32 (desc, &len))    if (mlib_rdint16 (desc, &desc->hdr.MThd_fmt))      DEB2 (printf ("Header: Format %d/n", desc->hdr.MThd_fmt));  if (mlib_rdint16 (desc, &desc->hdr.MThd_ntrk))    DEB2 (printf ("Header: ntrks %d/n", desc->hdr.MThd_ntrk));  if (mlib_rdbyte (desc, &hi))    if (mlib_rdbyte (desc, &lo))      if (hi & 0x80)		/* Negative */	{	  DEB2 (printf ("SMPTE timing: format = %d, resolution = %d/n",			(char) hi, lo));	  desc->hdr.time_mode = TIME_SMPTE;	  desc->hdr.SMPTE_format = (char) hi;	  desc->hdr.SMPTE_resolution = lo;	}      else	{	  desc->hdr.time_mode = TIME_MIDI;	  desc->hdr.division = (hi << 8) + lo;	  DEB2 (printf ("Midi timing: timebase = %d ppqn/n",			desc->hdr.division));	}  desc->curr_trk = -1;  desc->trk_offs = 0;  desc->next_trk_offs = 4 + 4 + len;;  return mlib_seek (desc, desc->trk_offs);	/* Point to the first track */}
开发者ID:Open-Sound-System,项目名称:Open-Sound-System,代码行数:52,


示例7: iic_ibmocp_handler

//// Description: The registered interrupt handler//static void iic_ibmocp_handler(int this_irq, void *dev_id, struct pt_regs *regs) {   int ret;   struct iic_regs *iic;   struct iic_ibm *priv_data = dev_id;   iic = (struct iic_regs *) priv_data->iic_base;   iic_pending = 1;   DEB2(printk("iic_ibmocp_handler: in interrupt handler/n"));   // Read status register   ret = readb((int) &(iic->sts));   DEB2(printk("iic_ibmocp_handler: status = %x/n", ret));   // Clear status register.  See IBM PPC 405 reference manual for details   writeb(0x0a, (int) &(iic->sts));   wake_up_interruptible(&(iic_wait[priv_data->index]));}
开发者ID:archith,项目名称:camera_project,代码行数:18,


示例8: pcf_sendbytes

static int pcf_sendbytes(struct i2c_adapter *i2c_adap, const char *buf,			 int count, int last){	struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;	int wrcount, status, timeout;	for (wrcount=0; wrcount<count; ++wrcount) {		DEB2(dev_dbg(&i2c_adap->dev, "i2c_write: writing %2.2X/n",				buf[wrcount] & 0xff));		i2c_outb(adap, buf[wrcount]);		timeout = wait_for_pin(adap, &status);		if (timeout) {			if (timeout == -EINTR)				return -EINTR; /* arbitration lost */			i2c_stop(adap);			dev_err(&i2c_adap->dev, "i2c_write: error - timeout./n");			return -EREMOTEIO; /* got a better one ?? */		}		if (status & I2C_PCF_LRB) {			i2c_stop(adap);			dev_err(&i2c_adap->dev, "i2c_write: error - no ack./n");			return -EREMOTEIO; /* got a better one ?? */		}	}	if (last)		i2c_stop(adap);	else		i2c_repstart(adap);	return wrcount;}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:32,


示例9: iic_avalanche_handler

static void iic_avalanche_handler(int this_irq, void *dev_id, struct pt_regs *regs){   iic_pending = 1;   DEB2(printk("iic_avalanche_handler: in interrupt handler/n"));   wake_up_interruptible(&iic_wait);}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:8,


示例10: pca_stop

static void pca_stop(struct i2c_algo_pca_data *adap){	int sta = pca_get_con(adap);	DEB2("=== STOP/n");	sta |= I2C_PCA_CON_STO;	sta &= ~(I2C_PCA_CON_STA|I2C_PCA_CON_SI);	pca_set_con(adap, sta);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:8,


示例11: pca_repeated_start

static int pca_repeated_start(struct i2c_algo_pca_data *adap){	int sta = pca_get_con(adap);	DEB2("=== REPEATED START/n");	sta |= I2C_PCA_CON_STA;	sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_SI);	pca_set_con(adap, sta);	return pca_wait(adap);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:9,


示例12: pca_start

/* * Generate a start condition on the i2c bus. * * returns after the start condition has occured */static void pca_start(struct i2c_algo_pca_data *adap){	int sta = pca_get_con(adap);	DEB2("=== START/n");	sta |= I2C_PCA_CON_STA;	sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_SI);	pca_set_con(adap, sta);	pca_wait(adap);}
开发者ID:GodFox,项目名称:magx_kernel_xpixl,代码行数:14,


示例13: pca_tx_byte

static int pca_tx_byte(struct i2c_algo_pca_data *adap,		       __u8 b){	int sta = pca_get_con(adap);	DEB2("=== WRITE %#04x/n", b);	pca_outw(adap, I2C_PCA_DAT, b);	sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI);	pca_set_con(adap, sta);	return pca_wait(adap);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:12,


示例14: wait_for_pin

static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status) {    int timeout = DEF_TIMEOUT;    *status = get_pcf(adap, 1);#ifndef STUB_I2C    while (timeout-- && (*status & I2C_PCF_PIN)) {        adap->waitforpin();        *status = get_pcf(adap, 1);    }    if (*status & I2C_PCF_LAB) {        DEB2(printk(KERN_INFO             "i2c-algo-pcf.o: lost arbitration (CSR 0x%02x)/n",             *status));        /* Cleanup from LAB-- reset and enable ESO.         * This resets the PCF8584; since we've lost the bus, no         * further attempts should be made by callers to clean up          * (no i2c_stop() etc.)         */        set_pcf(adap, 1, I2C_PCF_PIN);        set_pcf(adap, 1, I2C_PCF_ESO);        /* TODO: we should pause for a time period sufficient for any         * running I2C transaction to complete-- the arbitration         * logic won't work properly until the next START is seen.         */        DEB2(printk(KERN_INFO             "i2c-algo-pcf.o: reset LAB condition (CSR 0x%02x)/n",             get_pcf(adap,1)));        return(-EINTR);    }#endif    if (timeout <= 0)        return(-1);    else        return(0);}
开发者ID:274914765,项目名称:C,代码行数:36,


示例15: i2c_pcf_add_bus

/* * registering functions to load algorithms at runtime */int i2c_pcf_add_bus(struct i2c_adapter *adap){	struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;	int rval;	DEB2(dev_dbg(&adap->dev, "hw routines registered./n"));	/* register new adapter to i2c module... */	adap->algo = &pcf_algo;	if ((rval = pcf_init_8584(pcf_adap)))		return rval;	rval = i2c_add_adapter(adap);	return rval;}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:20,


示例16: pca_address

static int pca_address(struct i2c_algo_pca_data *adap,		       struct i2c_msg *msg){	int sta = pca_get_con(adap);	int addr;	addr = ((0x7f & msg->addr) << 1);	if (msg->flags & I2C_M_RD)		addr |= 1;	DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x/n",	     msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr);	pca_outw(adap, I2C_PCA_DAT, addr);	sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI);	pca_set_con(adap, sta);	return pca_wait(adap);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:19,


示例17: i2c_del_driver

int i2c_del_driver(struct i2c_driver *driver){	int i,j,k,res;	DRV_LOCK();	for (i = 0; i < I2C_DRIVER_MAX; i++)		if (driver == drivers[i])			break;	if (I2C_DRIVER_MAX == i) {		printk(KERN_WARNING " i2c-core.o: unregister_driver: "				    "[%s] not found/n",			driver->name);		DRV_UNLOCK();		return -ENODEV;	}	/* Have a look at each adapter, if clients of this driver are still	 * attached. If so, detach them to be able to kill the driver 	 * afterwards.	 */	DEB2(printk(KERN_DEBUG "i2c-core.o: unregister_driver - looking for clients./n"));	/* removing clients does not depend on the notify flag, else 	 * invalid operation might (will!) result, when using stale client	 * pointers.	 */	ADAP_LOCK(); /* should be moved inside the if statement... */	for (k=0;k<I2C_ADAP_MAX;k++) {		struct i2c_adapter *adap = adapters[k];		if (adap == NULL) /* skip empty entries. */			continue;		DEB2(printk(KERN_DEBUG "i2c-core.o: examining adapter %s:/n",			    adap->name));		if (driver->flags & I2C_DF_DUMMY) {		/* DUMMY drivers do not register their clients, so we have to		 * use a trick here: we call driver->attach_adapter to		 * *detach* it! Of course, each dummy driver should know about		 * this or hell will break loose...  		 */			if ((res = driver->attach_adapter(adap))) {				printk(KERN_WARNING "i2c-core.o: while unregistering "				       "dummy driver %s, adapter %s could "				       "not be detached properly; driver "				       "not unloaded!/n", driver->name,				       adap->name);				ADAP_UNLOCK();				return res;			}		} else {			for (j=0;j<I2C_CLIENT_MAX;j++) { 				struct i2c_client *client = adap->clients[j];				if (client != NULL && 				    client->driver == driver) {					DEB2(printk(KERN_DEBUG "i2c-core.o: "						    "detaching client %s:/n",					            client->name));					if ((res = driver->							detach_client(client)))					{						printk(KERN_ERR "i2c-core.o: while "						       "unregistering driver "						       "`%s', the client at "						       "address %02x of "						       "adapter `%s' could not "						       "be detached; driver "						       "not unloaded!/n",						       driver->name,						       client->addr,						       adap->name);						ADAP_UNLOCK();						return res;					}				}			}		}	}	ADAP_UNLOCK();	drivers[i] = NULL;	driver_count--;	DRV_UNLOCK();		DEB(printk(KERN_DEBUG "i2c-core.o: driver unregistered: %s/n",driver->name));	return 0;}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:82,


示例18: pca_xfer

static int pca_xfer(struct i2c_adapter *i2c_adap,                    struct i2c_msg msgs[],                    int num){        struct i2c_algo_pca_data *adap = i2c_adap->algo_data;        struct i2c_msg *msg = NULL;        int curmsg;	int numbytes = 0;	int state;	state = pca_status(adap);	if ( state != 0xF8 ) {		printk(KERN_ERR DRIVER ": bus is not idle. status is %#04x/n", state );		/* FIXME: what to do. Force stop ? */		return -EREMOTEIO;	}	DEB1("{{{ XFER %d messages/n", num);	if (i2c_debug>=2) {		for (curmsg = 0; curmsg < num; curmsg++) {			int addr, i;			msg = &msgs[curmsg];						addr = (0x7f & msg->addr) ;					if (msg->flags & I2C_M_RD )				printk(KERN_INFO "    [%02d] RD %d bytes from %#02x [%#02x, ...]/n", 				       curmsg, msg->len, addr, (addr<<1) | 1);			else {				printk(KERN_INFO "    [%02d] WR %d bytes to %#02x [%#02x%s", 				       curmsg, msg->len, addr, addr<<1,				       msg->len == 0 ? "" : ", ");				for(i=0; i < msg->len; i++)					printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", ");				printk("]/n");			}		}	}	curmsg = 0;	while (curmsg < num) {		state = pca_status(adap);		DEB3("STATE is 0x%02x/n", state);		msg = &msgs[curmsg];		switch (state) {		case 0xf8: /* On reset or stop the bus is idle */			pca_start(adap);			break;		case 0x08: /* A START condition has been transmitted */		case 0x10: /* A repeated start condition has been transmitted */			pca_address(adap, msg);			break;					case 0x18: /* SLA+W has been transmitted; ACK has been received */		case 0x28: /* Data byte in I2CDAT has been transmitted; ACK has been received */			if (numbytes < msg->len) {				pca_tx_byte(adap, msg->buf[numbytes]);				numbytes++;				break;			}			curmsg++; numbytes = 0;			if (curmsg == num)				pca_stop(adap);			else				pca_repeated_start(adap);			break;		case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */			DEB2("NOT ACK received after SLA+W/n");			pca_stop(adap);			return -EREMOTEIO;		case 0x40: /* SLA+R has been transmitted; ACK has been received */			pca_rx_ack(adap, msg->len > 1);			break;		case 0x50: /* Data bytes has been received; ACK has been returned */			if (numbytes < msg->len) {				pca_rx_byte(adap, &msg->buf[numbytes], 1);				numbytes++;				pca_rx_ack(adap, numbytes < msg->len - 1);				break;			} 			curmsg++; numbytes = 0;			if (curmsg == num)				pca_stop(adap);			else				pca_repeated_start(adap);			break;		case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */			DEB2("NOT ACK received after SLA+R/n");			pca_stop(adap);			return -EREMOTEIO;		case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received *///.........这里部分代码省略.........
开发者ID:GodFox,项目名称:magx_kernel_xpixl,代码行数:101,


示例19: pca_xfer

static int pca_xfer(struct i2c_adapter *i2c_adap,		    struct i2c_msg *msgs,		    int num){	struct i2c_algo_pca_data *adap = i2c_adap->algo_data;	struct i2c_msg *msg = NULL;	int curmsg;	int numbytes = 0;	int state;	int ret;	int completed = 1;	unsigned long timeout = jiffies + i2c_adap->timeout;	while ((state = pca_status(adap)) != 0xf8) {		if (time_before(jiffies, timeout)) {			msleep(10);		} else {			dev_dbg(&i2c_adap->dev, "bus is not idle. status is "				"%#04x/n", state);			return -EAGAIN;		}	}	DEB1("{{{ XFER %d messages/n", num);	if (i2c_debug >= 2) {		for (curmsg = 0; curmsg < num; curmsg++) {			int addr, i;			msg = &msgs[curmsg];			addr = (0x7f & msg->addr) ;			if (msg->flags & I2C_M_RD)				printk(KERN_INFO "    [%02d] RD %d bytes from %#02x [%#02x, ...]/n",				       curmsg, msg->len, addr, (addr << 1) | 1);			else {				printk(KERN_INFO "    [%02d] WR %d bytes to %#02x [%#02x%s",				       curmsg, msg->len, addr, addr << 1,				       msg->len == 0 ? "" : ", ");				for (i = 0; i < msg->len; i++)					printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", ");				printk("]/n");			}		}	}	curmsg = 0;	ret = -EREMOTEIO;	while (curmsg < num) {		state = pca_status(adap);		DEB3("STATE is 0x%02x/n", state);		msg = &msgs[curmsg];		switch (state) {		case 0xf8: /* On reset or stop the bus is idle */			completed = pca_start(adap);			break;		case 0x08: /* A START condition has been transmitted */		case 0x10: /* A repeated start condition has been transmitted */			completed = pca_address(adap, msg);			break;		case 0x18: /* SLA+W has been transmitted; ACK has been received */		case 0x28: /* Data byte in I2CDAT has been transmitted; ACK has been received */			if (numbytes < msg->len) {				completed = pca_tx_byte(adap,							msg->buf[numbytes]);				numbytes++;				break;			}			curmsg++; numbytes = 0;			if (curmsg == num)				pca_stop(adap);			else				completed = pca_repeated_start(adap);			break;		case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */			DEB2("NOT ACK received after SLA+W/n");			pca_stop(adap);			goto out;		case 0x40: /* SLA+R has been transmitted; ACK has been received */			completed = pca_rx_ack(adap, msg->len > 1);			break;		case 0x50: /* Data bytes has been received; ACK has been returned */			if (numbytes < msg->len) {				pca_rx_byte(adap, &msg->buf[numbytes], 1);				numbytes++;				completed = pca_rx_ack(adap,						       numbytes < msg->len - 1);				break;			}			curmsg++; numbytes = 0;			if (curmsg == num)				pca_stop(adap);			else//.........这里部分代码省略.........
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:101,


示例20: pca_rx_byte

static void pca_rx_byte(struct i2c_algo_pca_data *adap,			__u8 *b, int ack){	*b = pca_inw(adap, I2C_PCA_DAT);	DEB2("=== READ %#04x %s/n", *b, ack ? "ACK" : "NACK");}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:6,


示例21: octeon_i2c_xfer_msg

static int octeon_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int combined){    uint64_t data = 0;    int i;    int timeout = 0;    octeon_mio_tws_sw_twsi_t temp, mio_tws_sw_twsi;    octeon_mio_tws_sw_twsi_ext_t mio_tws_sw_twsi_ext;    DEB2("addr: 0x%04x, len: %d, flags: 0x%x, buf[0] = %x/n", msg->addr, msg->len, msg->flags, msg->buf[0]);    mio_tws_sw_twsi.u64 = 0x0;    mio_tws_sw_twsi.s.v = 1;    //ten bit address op<1> = 1    if( msg->flags & I2C_M_TEN) mio_tws_sw_twsi.s.op |= 0x2;    mio_tws_sw_twsi.s.a = msg->addr & 0x3ff;    // check the msg->len  0<=len <8    if( msg->len > 8 ){	printk("%s %d Error len msg->len %d/n", __FILE__, __LINE__, msg->len);	return (-1);    }    mio_tws_sw_twsi.s.sovr = 1;			// size override.    if ( msg->len == 0 )	       mio_tws_sw_twsi.s.size = 0;    else       mio_tws_sw_twsi.s.size = msg->len-1;	// Size: 0 = 1 byte, 1 = 2 bytes, ..., 7 = 8 bytes    if( msg->flags & I2C_M_RD ){	mio_tws_sw_twsi.s.r = 1;		// Enable Read bit     }else{		for(i =0; i <= mio_tws_sw_twsi.s.size; i++){	    data = data << 8;		    data |= msg->buf[i];	}	mio_tws_sw_twsi.s.d = data;	mio_tws_sw_twsi_ext.s.d = data >> 32;	    }	#ifdef I2C_OCTEON_DEBUG    if ( mio_tws_sw_twsi.s.r == 1 )	printk("twsi-read  op: data=%llx %llx len=%d/n", mio_tws_sw_twsi.u64, mio_tws_sw_twsi_ext.u64, msg->len);    else        printk("twsi-write op: data=%llx %llx len=%d/n", mio_tws_sw_twsi.u64, mio_tws_sw_twsi_ext.u64, msg->len);#endif    octeon_write_csr(OCTEON_MIO_TWS_SW_TWSI_EXT, mio_tws_sw_twsi_ext.u64);    octeon_write_csr(OCTEON_MIO_TWS_SW_TWSI, mio_tws_sw_twsi.u64);    //Poll! wait the transfer complete and timeout (10ms).    do{	temp.u64 = octeon_read_csr(OCTEON_MIO_TWS_SW_TWSI);		udelay(1);    }while (temp.s.v && (timeout++ < I2C_MAX_TIMEOUT));    mio_tws_sw_twsi.u64 = octeon_read_csr(OCTEON_MIO_TWS_SW_TWSI);    if (timeout >= I2C_MAX_TIMEOUT) {	printk("Octeon twsi I2C Timeout!/n");	octeon_i2c_reset();	return -EIO;    }    //transfer ERROR    if (!mio_tws_sw_twsi.s.r){	octeon_i2c_reset();	return -EIO;    }    if (msg->flags & I2C_M_RD){	mio_tws_sw_twsi_ext.u64 = octeon_read_csr(OCTEON_MIO_TWS_SW_TWSI_EXT);	data = ((uint64_t) mio_tws_sw_twsi_ext.s.d << 32) | mio_tws_sw_twsi.s.d;	#ifdef I2C_OCTEON_DEBUG	printk("twsi-read result: data=%llx %llx len=%d/n", mio_tws_sw_twsi.u64, mio_tws_sw_twsi_ext.u64, msg->len);#endif	for(i = mio_tws_sw_twsi.s.size; i >= 0; i--){		msg->buf[i] = data;		data = data >> 8; 	}	    }
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:87,



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


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