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

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

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

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

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

示例1: xhci_hub_status_data

/* * Returns 0 if the status hasn't changed, or the number of bytes in buf. * Ports are 0-indexed from the HCD point of view, * and 1-indexed from the USB core pointer of view. * * Note that the status change bits will be cleared as soon as a port status * change event is generated, so we use the saved status from that event. */int xhci_hub_status_data(struct usb_hcd *hcd, char *buf){	unsigned long flags;	u32 temp, status;	u32 mask;	int i, retval;	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	/* Initial status is no changes */	retval = (max_ports + 8) / 8;	memset(buf, 0, retval);	status = 0;	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;	spin_lock_irqsave(&xhci->lock, flags);	/* For each port, did anything change?  If so, set that bit in buf. */	for (i = 0; i < max_ports; i++) {		temp = xhci_readl(xhci, port_array[i]);		if (temp == 0xffffffff) {			retval = -ENODEV;			break;		}		if ((temp & mask) != 0 ||			(bus_state->port_c_suspend & 1 << i) ||			(bus_state->resume_done[i] && time_after_eq(			    jiffies, bus_state->resume_done[i]))) {			buf[(i + 1) / 8] |= 1 << (i + 1) % 8;			status = 1;		}	}	spin_unlock_irqrestore(&xhci->lock, flags);	return status ? retval : 0;}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:48,


示例2: dfs_timeout

static voiddfs_timeout(void *arg){	struct ieee80211com *ic = arg;	struct ieee80211_dfs_state *dfs = &ic->ic_dfs;	struct ieee80211_channel *c;	int i, oldest, now;	IEEE80211_LOCK_ASSERT(ic);	now = oldest = ticks;	for (i = 0; i < ic->ic_nchans; i++) {		c = &ic->ic_channels[i];		if (IEEE80211_IS_CHAN_RADAR(c)) {			if (time_after_eq(now, dfs->nol_event[i]+NOL_TIMEOUT)) {				c->ic_state &= ~IEEE80211_CHANSTATE_RADAR;				if (c->ic_state & IEEE80211_CHANSTATE_NORADAR) {					/*					 * NB: do this here so we get only one					 * msg instead of one for every channel					 * table entry.					 */					if_printf(ic->ic_ifp, "radar on channel"					    " %u (%u MHz) cleared after timeout/n",					    c->ic_ieee, c->ic_freq);					/* notify user space */					c->ic_state &=					    ~IEEE80211_CHANSTATE_NORADAR;					ieee80211_notify_radar(ic, c);				}			} else if (dfs->nol_event[i] < oldest)				oldest = dfs->nol_event[i];		}	}	if (oldest != now) {		/* arrange to process next channel up for a status change */		callout_schedule_dfly(&dfs->nol_timer, oldest + NOL_TIMEOUT - now,				dfs_timeout, ic);	}}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:40,


示例3: snd_cs8427_reset

/* * Reset the chip using run bit, also lock PLL using ILRCK and * put back AES3INPUT. This workaround is described in latest * CS8427 datasheet, otherwise TXDSERIAL will not work. */static void snd_cs8427_reset(struct snd_i2c_device *cs8427){	struct cs8427 *chip;	unsigned long end_time;	int data, aes3input = 0;	if (snd_BUG_ON(!cs8427))		return;	chip = cs8427->private_data;	snd_i2c_lock(cs8427->bus);	if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) ==	    CS8427_RXDAES3INPUT)  /* AES3 bit is set */		aes3input = 1;	chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK);	snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,			     chip->regmap[CS8427_REG_CLOCKSOURCE]);	udelay(200);	chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RUN | CS8427_RXDILRCK;	snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,			     chip->regmap[CS8427_REG_CLOCKSOURCE]);	udelay(200);	snd_i2c_unlock(cs8427->bus);	end_time = jiffies + chip->reset_timeout;	while (time_after_eq(end_time, jiffies)) {		snd_i2c_lock(cs8427->bus);		data = snd_cs8427_reg_read(cs8427, CS8427_REG_RECVERRORS);		snd_i2c_unlock(cs8427->bus);		if (!(data & CS8427_UNLOCK))			break;		schedule_timeout_uninterruptible(1);	}	snd_i2c_lock(cs8427->bus);	chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;	if (aes3input)		chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RXDAES3INPUT;	snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,			     chip->regmap[CS8427_REG_CLOCKSOURCE]);	snd_i2c_unlock(cs8427->bus);}
开发者ID:nos1609,项目名称:Chrono_Kernel-1,代码行数:44,


示例4: card_wait_for_busy_clear

/* Card Wait For Busy Clear (cannot be used during an interrupt) */static intcard_wait_for_busy_clear(const int ioaddr[], const char* name){	unsigned char a;	unsigned long timeout;	a = inb(ioaddr[0] + 7);	timeout = jiffies + TimeOutJiffies;	while (a & 0x80 || a & 0x40) {		/* a little sleep */		yield();		a = inb(ioaddr[0] + 7);		if (time_after_eq(jiffies, timeout)) {			printk(KERN_WARNING "%s: card_wait_for_busy_clear timeout/n",				name);			return -ETIME;		}	}	return 0;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:23,


示例5: txc43128_phy_poll

/* Periodic callback: this exists mainly to poll link status as we * don't use LASI interrupts */static bool txc43128_phy_poll(struct efx_nic *efx){	struct txc43128_data *data = efx->phy_data;	bool was_up = efx->link_state.up;	efx->link_state.up = txc43128_phy_read_link(efx);	efx->link_state.speed = 10000;	efx->link_state.fd = true;	efx->link_state.fc = efx->wanted_fc;	if (efx->link_state.up || (efx->loopback_mode != LOOPBACK_NONE)) {		data->bug10934_timer = jiffies;	} else {		if (time_after_eq(jiffies, (data->bug10934_timer +					    BUG10934_RESET_INTERVAL))) {			data->bug10934_timer = jiffies;			txc_reset_logic(efx);		}	}	return efx->link_state.up != was_up;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:24,


示例6: ip6_fl_gc

static void ip6_fl_gc(unsigned long dummy){	int i;	unsigned long now = jiffies;	unsigned long sched = 0;	spin_lock(&ip6_fl_lock);	for (i = 0; i <= FL_HASH_MASK; i++) {		struct ip6_flowlabel *fl;		struct ip6_flowlabel __rcu **flp;		flp = &fl_ht[i];		while ((fl = rcu_dereference_protected(*flp,						       lockdep_is_held(&ip6_fl_lock))) != NULL) {			if (atomic_read(&fl->users) == 0) {				unsigned long ttd = fl->lastuse + fl->linger;				if (time_after(ttd, fl->expires))					fl->expires = ttd;				ttd = fl->expires;				if (time_after_eq(now, ttd)) {					*flp = fl->next;					fl_free(fl);					atomic_dec(&fl_size);					continue;				}				if (!sched || time_before(ttd, sched))					sched = ttd;			}			flp = &fl->next;		}	}	if (!sched && atomic_read(&fl_size))		sched = now + FL_MAX_LINGER;	if (sched) {		mod_timer(&ip6_fl_gc_timer, sched);	}	spin_unlock(&ip6_fl_lock);}
开发者ID:19Dan01,项目名称:linux,代码行数:39,


示例7: falcon_spi_wait

static int falcon_spi_wait(struct efx_nic *efx){	unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 10);	int i;	for (i = 0; i < 10; i++) {		if (!falcon_spi_poll(efx))			return 0;		udelay(10);	}	for (;;) {		if (!falcon_spi_poll(efx))			return 0;		if (time_after_eq(jiffies, timeout)) {			netif_err(efx, hw, efx->net_dev,				  "timed out waiting for SPI/n");			return -ETIMEDOUT;		}		schedule_timeout_uninterruptible(1);	}}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:22,


示例8: wait_till_ready

static int wait_till_ready(struct spi_device *spi_nand){	unsigned long deadline;	int retval;	u8 stat = 0;	deadline = jiffies + MAX_WAIT_JIFFIES;	do {		retval = spinand_read_status(spi_nand, &stat);		if (retval < 0)			return -1;		else if (!(stat & 0x1))			break;		cond_resched();	} while (!time_after_eq(jiffies, deadline));	if ((stat & 0x1) == 0)		return 0;	return -1;}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:22,


示例9: ocxl_config_terminate_pasid

int ocxl_config_terminate_pasid(struct pci_dev *dev, int afu_control, int pasid){	u32 val;	unsigned long timeout;	pci_read_config_dword(dev, afu_control + OCXL_DVSEC_AFU_CTRL_TERM_PASID,			&val);	if (EXTRACT_BIT(val, 20)) {		dev_err(&dev->dev,			"Can't terminate PASID %#x, previous termination didn't complete/n",			pasid);		return -EBUSY;	}	val &= ~OCXL_DVSEC_PASID_MASK;	val |= pasid & OCXL_DVSEC_PASID_MASK;	val |= BIT(20);	pci_write_config_dword(dev,			afu_control + OCXL_DVSEC_AFU_CTRL_TERM_PASID,			val);	timeout = jiffies + (HZ * OCXL_CFG_TIMEOUT);	pci_read_config_dword(dev, afu_control + OCXL_DVSEC_AFU_CTRL_TERM_PASID,			&val);	while (EXTRACT_BIT(val, 20)) {		if (time_after_eq(jiffies, timeout)) {			dev_err(&dev->dev,				"Timeout while waiting for AFU to terminate PASID %#x/n",				pasid);			return -EBUSY;		}		cpu_relax();		pci_read_config_dword(dev,				afu_control + OCXL_DVSEC_AFU_CTRL_TERM_PASID,				&val);	}	return 0;}
开发者ID:avagin,项目名称:linux,代码行数:38,


示例10: mmc_auto_suspend

/* Return value = 0 when resume is done * Return value = 1 when suspend is done */int mmc_auto_suspend(struct mmc_host *host, int suspend){	int	status = -1;	unsigned long next_timeout, timeout;	unsigned long j = jiffies;	if (host->card && mmc_card_sdio(host->card))		return -1;	mutex_lock(&host->auto_suspend_mutex);	if (suspend) {		if (host->auto_suspend_state)			goto out;		timeout = host->last_busy + host->idle_timeout;		if (time_after_eq(j, timeout)) {			host->auto_suspend_state = 1;			host->ops->auto_suspend(host, 1); /* suspend host */			status = 1;			goto out;		}	} else {		host->last_busy = j;		if (host->auto_suspend_state) {			host->ops->auto_suspend(host, 0); /* resume host */			host->auto_suspend_state = 0;			status = 0;		}	}	if (host->idle_timeout >= 0) {		next_timeout = host->idle_timeout - (j - host->last_busy);		mmc_schedule_autosuspend(host, next_timeout);	}out:	mutex_unlock(&host->auto_suspend_mutex);	return status;}
开发者ID:crosslink,项目名称:android_kernel_semc_es209ra,代码行数:41,


示例11: mixart_wait_nice_for_register_value

/** * wait for a value on a peudo register, exit with a timeout * * @param mgr pointer to miXart manager structure * @param offset unsigned pseudo_register base + offset of value * @param value value * @param timeout timeout in centisenconds */static int mixart_wait_nice_for_register_value(struct mixart_mgr *mgr,					       u32 offset, int is_egal,					       u32 value, unsigned long timeout){	unsigned long end_time = jiffies + (timeout * HZ / 100);	u32 read;	do {	/* we may take too long time in this loop.		 * so give controls back to kernel if needed.		 */		cond_resched();		read = readl_be( MIXART_MEM( mgr, offset ));		if(is_egal) {			if(read == value) return 0;		}		else { /* wait for different value */			if(read != value) return 0;		}	} while ( time_after_eq(end_time, jiffies) );	return -EBUSY;}
开发者ID:JS-Wang,项目名称:linux-testing,代码行数:31,


示例12: falcon_spi_wait_write

/* Wait up to 10 ms for buffered write completion */intfalcon_spi_wait_write(struct efx_nic *efx, const struct efx_spi_device *spi){	unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 100);	u8 status;	int rc;	for (;;) {		rc = falcon_spi_cmd(efx, spi, SPI_RDSR, -1, NULL,				    &status, sizeof(status));		if (rc)			return rc;		if (!(status & SPI_STATUS_NRDY))			return 0;		if (time_after_eq(jiffies, timeout)) {			EFX_ERR(efx, "SPI write timeout on device %d"				" last status=0x%02x/n",				spi->device_id, status);			return -ETIMEDOUT;		}		schedule_timeout_uninterruptible(1);	}}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:24,


示例13: mc_polling_wait_preemptible

/** * Waits for the completion of an MC command doing preemptible polling. * uslepp_range() is called between polling iterations. * * @mc_io: MC I/O object to be used * @cmd: command buffer to receive MC response * @mc_status: MC command completion status */static int mc_polling_wait_preemptible(struct fsl_mc_io *mc_io,				       struct mc_command *cmd,				       enum mc_cmd_status *mc_status){	enum mc_cmd_status status;	unsigned long jiffies_until_timeout =		jiffies + msecs_to_jiffies(MC_CMD_COMPLETION_TIMEOUT_MS);	/*	 * Wait for response from the MC hardware:	 */	for (;;) {		status = mc_read_response(mc_io->portal_virt_addr, cmd);		if (status != MC_CMD_STATUS_READY)			break;		/*		 * TODO: When MC command completion interrupts are supported		 * call wait function here instead of usleep_range()		 */		usleep_range(MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS,			     MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS);		if (time_after_eq(jiffies, jiffies_until_timeout)) {			dev_dbg(mc_io->dev,				"MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)/n",				 mc_io->portal_phys_addr,				 (unsigned int)mc_cmd_hdr_read_token(cmd),				 (unsigned int)mc_cmd_hdr_read_cmdid(cmd));			return -ETIMEDOUT;		}	}	*mc_status = status;	return 0;}
开发者ID:AK101111,项目名称:linux,代码行数:45,


示例14: ip6_fl_gc

static void ip6_fl_gc(unsigned long dummy){	int i;	unsigned long now = jiffies;	unsigned long sched = 0;	write_lock(&ip6_fl_lock);	for (i=0; i<=FL_HASH_MASK; i++) {		struct ip6_flowlabel *fl, **flp;		flp = &fl_ht[i];		while ((fl=*flp) != NULL) {			if (atomic_read(&fl->users) == 0) {				unsigned long ttd = fl->lastuse + fl->linger;				if (time_after(ttd, fl->expires))					fl->expires = ttd;				ttd = fl->expires;				if (time_after_eq(now, ttd)) {					*flp = fl->next;					fl_free(fl);					atomic_dec(&fl_size);					continue;				}				if (!sched || time_before(ttd, sched))					sched = ttd;			}			flp = &fl->next;		}	}	if (!sched && atomic_read(&fl_size))		sched = now + FL_MAX_LINGER;	if (sched) {		ip6_fl_gc_timer.expires = sched;		add_timer(&ip6_fl_gc_timer);	}	write_unlock(&ip6_fl_lock);}
开发者ID:gizm0n,项目名称:wl500g,代码行数:37,


示例15: sb1000_wait_for_ready

/* Card Wait For Ready (to be used during frame rx) */static inline intsb1000_wait_for_ready(const int ioaddr[], const char* name){	unsigned long timeout;	timeout = jiffies + Sb1000TimeOutJiffies;	while (inb(ioaddr[1] + 6) & 0x80) {		if (jiffies >= timeout) {			printk(KERN_WARNING "%s: sb1000_wait_for_ready timeout/n",				name);			return -ETIME;		}	}	timeout = jiffies + Sb1000TimeOutJiffies;	while (!(inb(ioaddr[1] + 6) & 0x40)) {		if (time_after_eq(jiffies, timeout)) {			printk(KERN_WARNING "%s: sb1000_wait_for_ready timeout/n",				name);			return -ETIME;		}	}	inb(ioaddr[0] + 7);	return 0;}
开发者ID:archith,项目名称:camera_project,代码行数:25,


示例16: drain_mcelog_buffer

static void drain_mcelog_buffer(void){	unsigned int next, i, prev = 0;	next = rcu_dereference_check_mce(mcelog.next);	do {		struct mce *m;		/* drain what was logged during boot */		for (i = prev; i < next; i++) {			unsigned long start = jiffies;			unsigned retries = 1;			m = &mcelog.entry[i];			while (!m->finished) {				if (time_after_eq(jiffies, start + 2*retries))					retries++;				cpu_relax();				if (!m->finished && retries >= 4) {					pr_err("MCE: skipping error being logged currently!/n");					break;				}			}			smp_rmb();			atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m);		}		memset(mcelog.entry + prev, 0, (next - prev) * sizeof(*m));		prev = next;		next = cmpxchg(&mcelog.next, prev, 0);	} while (next != prev);}
开发者ID:Huanglihan,项目名称:linux,代码行数:36,


示例17: wait_for

static int wait_for(unsigned short set, unsigned short clr,               unsigned long delay, unsigned minor){      unsigned short pins = get_pins(minor);      unsigned long extime = 0;      /*       * Try a real fast scan for the first jiffy, in case the device       * responds real good. The first while loop guesses an expire       * time accounting for possible wraparound of jiffies.       */      while (time_after_eq(jiffies, extime)) extime = jiffies + 1;      while ( (time_before(jiffies, extime))              && (((pins & set) != set) || ((pins & clr) != 0)) ) {            pins = get_pins(minor);      }      delay -= 1;      /*       * If my delay expired or the pins are still not where I want       * them, then resort to using the timer and greatly reduce my       * sample rate. If the peripheral is going to be slow, this will       * give the CPU up to some more worthy process.       */      while ( delay && (((pins & set) != set) || ((pins & clr) != 0)) ) {            snooze(1, minor);            pins = get_pins(minor);            delay -= 1;      }      if (delay == 0) return -1;      else return pins;}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:36,


示例18: ceph_monc_wait_osdmap

int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,			  unsigned long timeout){	unsigned long started = jiffies;	int ret;	mutex_lock(&monc->mutex);	while (monc->have_osdmap < epoch) {		mutex_unlock(&monc->mutex);		if (timeout != 0 && time_after_eq(jiffies, started + timeout))			return -ETIMEDOUT;		ret = wait_event_interruptible_timeout(monc->client->auth_wq,					 monc->have_osdmap >= epoch, timeout);		if (ret < 0)			return ret;		mutex_lock(&monc->mutex);	}	mutex_unlock(&monc->mutex);	return 0;}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:24,


示例19: spi_nor_wait_till_ready

/* * Service routine to read status register until ready, or timeout occurs. * Returns non-zero if error. */static int spi_nor_wait_till_ready(struct spi_nor *nor){	unsigned long deadline;	int timeout = 0, ret;	deadline = jiffies + MAX_READY_WAIT_JIFFIES;	while (!timeout) {		if (time_after_eq(jiffies, deadline))			timeout = 1;		ret = spi_nor_ready(nor);		if (ret < 0)			return ret;		if (ret)			return 0;		cond_resched();	}	dev_err(nor->dev, "flash operation timed out/n");	return -ETIMEDOUT;}
开发者ID:Abioy,项目名称:kasan,代码行数:28,


示例20: qla4xxx_mailbox_command

/** * qla4xxx_mailbox_command - issues mailbox commands * @ha: Pointer to host adapter structure. * @inCount: number of mailbox registers to load. * @outCount: number of mailbox registers to return. * @mbx_cmd: data pointer for mailbox in registers. * @mbx_sts: data pointer for mailbox out registers. * * This routine sssue mailbox commands and waits for completion. * If outCount is 0, this routine completes successfully WITHOUT waiting * for the mailbox command to complete. **/static int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,				   uint8_t outCount, uint32_t *mbx_cmd,				   uint32_t *mbx_sts){	int status = QLA_ERROR;	uint8_t i;	u_long wait_count;	uint32_t intr_status;	unsigned long flags = 0;	/* Make sure that pointers are valid */	if (!mbx_cmd || !mbx_sts) {		DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts "			      "pointer/n", ha->host_no, __func__));		return status;	}	/* Mailbox code active */	wait_count = MBOX_TOV * 100;	while (wait_count--) {		mutex_lock(&ha->mbox_sem);		if (!test_bit(AF_MBOX_COMMAND, &ha->flags)) {			set_bit(AF_MBOX_COMMAND, &ha->flags);			mutex_unlock(&ha->mbox_sem);			break;		}		mutex_unlock(&ha->mbox_sem);		if (!wait_count) {			DEBUG2(printk("scsi%ld: %s: mbox_sem failed/n",				ha->host_no, __func__));			return status;		}		msleep(10);	}	/* To prevent overwriting mailbox registers for a command that has	 * not yet been serviced, check to see if a previously issued	 * mailbox command is interrupting.	 * -----------------------------------------------------------------	 */	spin_lock_irqsave(&ha->hardware_lock, flags);	intr_status = readl(&ha->reg->ctrl_status);	if (intr_status & CSR_SCSI_PROCESSOR_INTR) {		/* Service existing interrupt */		qla4xxx_interrupt_service_routine(ha, intr_status);		clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);	}	/* Send the mailbox command to the firmware */	ha->mbox_status_count = outCount;	for (i = 0; i < outCount; i++)		ha->mbox_status[i] = 0;	/* Load all mailbox registers, except mailbox 0. */	for (i = 1; i < inCount; i++)		writel(mbx_cmd[i], &ha->reg->mailbox[i]);	/* Wakeup firmware  */	writel(mbx_cmd[0], &ha->reg->mailbox[0]);	readl(&ha->reg->mailbox[0]);	writel(set_rmask(CSR_INTR_RISC), &ha->reg->ctrl_status);	readl(&ha->reg->ctrl_status);	spin_unlock_irqrestore(&ha->hardware_lock, flags);	/* Wait for completion */	/*	 * If we don't want status, don't wait for the mailbox command to	 * complete.  For example, MBOX_CMD_RESET_FW doesn't return status,	 * you must poll the inbound Interrupt Mask for completion.	 */	if (outCount == 0) {		status = QLA_SUCCESS;		goto mbox_exit;	}	/* Wait for command to complete */	wait_count = jiffies + MBOX_TOV * HZ;	while (test_bit(AF_MBOX_COMMAND_DONE, &ha->flags) == 0) {		if (time_after_eq(jiffies, wait_count))			break;		spin_lock_irqsave(&ha->hardware_lock, flags);		intr_status = readl(&ha->reg->ctrl_status);		if (intr_status & INTR_PENDING) {			/*			 * Service the interrupt.			 * The ISR will save the mailbox status registers			 * to a temporary storage location in the adapter//.........这里部分代码省略.........
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:101,


示例21: do_catch_up

static void do_catch_up(struct spk_synth *synth){	u_char ch;	unsigned long flags;	unsigned long jiff_max;	int timeout;	int delay_time_val;	int jiffy_delta_val;	int full_time_val;	struct var_t *delay_time;	struct var_t *full_time;	struct var_t *jiffy_delta;	jiffy_delta = spk_get_var(JIFFY);	delay_time = spk_get_var(DELAY);	full_time = spk_get_var(FULL);	spin_lock_irqsave(&speakup_info.spinlock, flags);	jiffy_delta_val = jiffy_delta->u.n.value;	spin_unlock_irqrestore(&speakup_info.spinlock, flags);	jiff_max = jiffies + jiffy_delta_val;	while (!kthread_should_stop()) {		spin_lock_irqsave(&speakup_info.spinlock, flags);		if (speakup_info.flushing) {			speakup_info.flushing = 0;			spin_unlock_irqrestore(&speakup_info.spinlock, flags);			synth->flush(synth);			continue;		}		if (synth_buffer_empty()) {			spin_unlock_irqrestore(&speakup_info.spinlock, flags);			break;		}		set_current_state(TASK_INTERRUPTIBLE);		full_time_val = full_time->u.n.value;		spin_unlock_irqrestore(&speakup_info.spinlock, flags);		if (synth_full()) {			schedule_timeout(msecs_to_jiffies(full_time_val));			continue;		}		set_current_state(TASK_RUNNING);		timeout = SPK_XMITR_TIMEOUT;		while (synth_writable()) {			if (!--timeout)				break;			udelay(1);		}		spin_lock_irqsave(&speakup_info.spinlock, flags);		ch = synth_buffer_getc();		spin_unlock_irqrestore(&speakup_info.spinlock, flags);		if (ch == '/n')			ch = PROCSPEECH;		outb_p(ch, speakup_info.port_tts);		if (time_after_eq(jiffies, jiff_max) && ch == SPACE) {			timeout = SPK_XMITR_TIMEOUT;			while (synth_writable()) {				if (!--timeout)					break;				udelay(1);			}			outb_p(PROCSPEECH, speakup_info.port_tts);			spin_lock_irqsave(&speakup_info.spinlock, flags);			jiffy_delta_val = jiffy_delta->u.n.value;			delay_time_val = delay_time->u.n.value;			spin_unlock_irqrestore(&speakup_info.spinlock, flags);			schedule_timeout(msecs_to_jiffies(delay_time_val));			jiff_max = jiffies+jiffy_delta_val;		}	}	timeout = SPK_XMITR_TIMEOUT;	while (synth_writable()) {		if (!--timeout)			break;		udelay(1);	}	outb_p(PROCSPEECH, speakup_info.port_tts);}
开发者ID:7799,项目名称:linux,代码行数:78,


示例22: timer_trig_handler

static void timer_trig_handler(struct work_struct *work){	reg_timer_rw_ack_intr ack_intr = { 0 };	reg_timer_rw_intr_mask intr_mask;	reg_timer_rw_trig_cfg trig_cfg = { 0 };	struct fast_timer *t;	fast_timer_function_type *f;	unsigned long d;	unsigned long flags;	/* We keep interrupts disabled not only when we modify the	 * fast timer list, but any time we hold a reference to a	 * timer in the list, since del_fast_timer may be called	 * from (another) interrupt context.  Thus, the only time	 * when interrupts are enabled is when calling the timer	 * callback function.	 */  local_irq_save(flags);  /* Clear timer trig interrupt */	intr_mask = REG_RD(timer, regi_timer0, rw_intr_mask);  intr_mask.trig = 0;  REG_WR(timer, regi_timer0, rw_intr_mask, intr_mask);  /* First stop timer, then ack interrupt */  /* Stop timer */  trig_cfg.tmr = regk_timer_off;	REG_WR(timer, regi_timer0, rw_trig_cfg, trig_cfg);  /* Ack interrupt */  ack_intr.trig = 1;	REG_WR(timer, regi_timer0, rw_ack_intr, ack_intr);  fast_timer_running = 0;  fast_timer_ints++;  t = fast_timer_list;	while (t) {		struct fasttime_t tv;    /* Has it really expired? */    do_gettimeofday_fast(&tv);		D1(printk(KERN_DEBUG			"t: %is %06ius/n", tv.tv_jiff, tv.tv_usec));		if (fasttime_cmp(&t->tv_expires, &tv) <= 0) {      /* Yes it has expired */#ifdef FAST_TIMER_LOG      timer_expired_log[fast_timers_expired % NUM_TIMER_STATS] = *t;#endif      fast_timers_expired++;      /* Remove this timer before call, since it may reuse the timer */      if (t->prev)        t->prev->next = t->next;      else        fast_timer_list = t->next;      if (t->next)        t->next->prev = t->prev;      t->prev = NULL;      t->next = NULL;			/* Save function callback data before enabling			 * interrupts, since the timer may be removed and we			 * don't know how it was allocated (e.g. ->function			 * and ->data may become overwritten after deletion			 * if the timer was stack-allocated).			 */			f = t->function;			d = t->data;			if (f != NULL) {				/* Run the callback function with interrupts				 * enabled. */				local_irq_restore(flags);				f(d);				local_irq_save(flags);			} else        DEBUG_LOG("!trimertrig %i function==NULL!/n", fast_timer_ints);		} else {      /* Timer is to early, let's set it again using the normal routines */      D1(printk("./n"));    }		t = fast_timer_list;		if (t != NULL) {      /* Start next timer.. */			long us = 0;			struct fasttime_t tv;      do_gettimeofday_fast(&tv);			/* time_after_eq takes care of wrapping */			if (time_after_eq(t->tv_expires.tv_jiff, tv.tv_jiff))				us = ((t->tv_expires.tv_jiff - tv.tv_jiff) *					1000000 / HZ + t->tv_expires.tv_usec -					tv.tv_usec);			if (us > 0) {				if (!fast_timer_running) {//.........这里部分代码省略.........
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:101,


示例23: timer_interrupt

static irqreturn_ttimer_interrupt (int irq, void *dev_id){    unsigned long new_itm;    if (cpu_is_offline(smp_processor_id())) {        return IRQ_HANDLED;    }    platform_timer_interrupt(irq, dev_id);    new_itm = local_cpu_data->itm_next;    if (!time_after(ia64_get_itc(), new_itm))        printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)/n",               ia64_get_itc(), new_itm);    profile_tick(CPU_PROFILING);    if (paravirt_do_steal_accounting(&new_itm))        goto skip_process_time_accounting;    while (1) {        update_process_times(user_mode(get_irq_regs()));        new_itm += local_cpu_data->itm_delta;        if (smp_processor_id() == time_keeper_id)            xtime_update(1);        local_cpu_data->itm_next = new_itm;        if (time_after(new_itm, ia64_get_itc()))            break;        /*         * Allow IPIs to interrupt the timer loop.         */        local_irq_enable();        local_irq_disable();    }skip_process_time_accounting:    do {        /*         * If we're too close to the next clock tick for         * comfort, we increase the safety margin by         * intentionally dropping the next tick(s).  We do NOT         * update itm.next because that would force us to call         * xtime_update() which in turn would let our clock run         * too fast (with the potentially devastating effect         * of losing monotony of time).         */        while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))            new_itm += local_cpu_data->itm_delta;        ia64_set_itm(new_itm);        /* double check, in case we got hit by a (slow) PMI: */    } while (time_after_eq(ia64_get_itc(), new_itm));    return IRQ_HANDLED;}
开发者ID:AbheekG,项目名称:XIA-for-Linux,代码行数:61,


示例24: journal_stop

int journal_stop(handle_t *handle){	transaction_t *transaction = handle->h_transaction;	journal_t *journal = transaction->t_journal;	int err;	pid_t pid;	J_ASSERT(journal_current_handle() == handle);	if (is_handle_aborted(handle))		err = -EIO;	else {		J_ASSERT(transaction->t_updates > 0);		err = 0;	}	if (--handle->h_ref > 0) {		jbd_debug(4, "h_ref %d -> %d/n", handle->h_ref + 1,			  handle->h_ref);		return err;	}	jbd_debug(4, "Handle %p going down/n", handle);	/*	 * Implement synchronous transaction batching.  If the handle	 * was synchronous, don't force a commit immediately.  Let's	 * yield and let another thread piggyback onto this transaction.	 * Keep doing that while new threads continue to arrive.	 * It doesn't cost much - we're about to run a commit and sleep	 * on IO anyway.  Speeds up many-threaded, many-dir operations	 * by 30x or more...	 *	 * We try and optimize the sleep time against what the underlying disk	 * can do, instead of having a static sleep time.  This is usefull for	 * the case where our storage is so fast that it is more optimal to go	 * ahead and force a flush and wait for the transaction to be committed	 * than it is to wait for an arbitrary amount of time for new writers to	 * join the transaction.  We achieve this by measuring how long it takes	 * to commit a transaction, and compare it with how long this	 * transaction has been running, and if run time < commit time then we	 * sleep for the delta and commit.  This greatly helps super fast disks	 * that would see slowdowns as more threads started doing fsyncs.	 *	 * But don't do this if this process was the most recent one to	 * perform a synchronous write.  We do this to detect the case where a	 * single process is doing a stream of sync writes.  No point in waiting	 * for joiners in that case.	 */	pid = current->pid;	if (handle->h_sync && journal->j_last_sync_writer != pid) {		u64 commit_time, trans_time;		journal->j_last_sync_writer = pid;		spin_lock(&journal->j_state_lock);		commit_time = journal->j_average_commit_time;		spin_unlock(&journal->j_state_lock);		trans_time = ktime_to_ns(ktime_sub(ktime_get(),						   transaction->t_start_time));		commit_time = min_t(u64, commit_time,				    1000*jiffies_to_usecs(1));		if (trans_time < commit_time) {			ktime_t expires = ktime_add_ns(ktime_get(),						       commit_time);			set_current_state(TASK_UNINTERRUPTIBLE);			schedule_hrtimeout(&expires, HRTIMER_MODE_ABS);		}	}	if (handle->h_sync)		transaction->t_synchronous_commit = 1;	current->journal_info = NULL;	spin_lock(&journal->j_state_lock);	spin_lock(&transaction->t_handle_lock);	transaction->t_outstanding_credits -= handle->h_buffer_credits;	transaction->t_updates--;	if (!transaction->t_updates) {		wake_up(&journal->j_wait_updates);		if (journal->j_barrier_count)			wake_up(&journal->j_wait_transaction_locked);	}	/*	 * If the handle is marked SYNC, we need to set another commit	 * going!  We also want to force a commit if the current	 * transaction is occupying too much of the log, or if the	 * transaction is too old now.	 */	if (handle->h_sync ||			transaction->t_outstanding_credits >				journal->j_max_transaction_buffers ||			time_after_eq(jiffies, transaction->t_expires)) {		/* Do this even for aborted journals: an abort still		 * completes the commit thread, it just doesn't write		 * anything to disk. */		tid_t tid = transaction->t_tid;//.........这里部分代码省略.........
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:101,


示例25: receive_pcb

static int receive_pcb(struct net_device *dev, pcb_struct * pcb){	int i, j;	int total_length;	int stat;	unsigned long timeout;	unsigned long flags;	elp_device *adapter = dev->priv;	set_hsf(dev, 0);	/* get the command code */	timeout = jiffies + 2*HZ/100;	while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout));	if (time_after_eq(jiffies, timeout)) {		TIMEOUT_MSG(__LINE__);		return FALSE;	}	pcb->command = inb_command(dev->base_addr);	/* read the data length */	timeout = jiffies + 3*HZ/100;	while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout));	if (time_after_eq(jiffies, timeout)) {		TIMEOUT_MSG(__LINE__);		printk(KERN_INFO "%s: status %02x/n", dev->name, stat);		return FALSE;	}	pcb->length = inb_command(dev->base_addr);	if (pcb->length > MAX_PCB_DATA) {		INVALID_PCB_MSG(pcb->length);		adapter_reset(dev);		return FALSE;	}	/* read the data */	spin_lock_irqsave(&adapter->lock, flags);	i = 0;	do {		j = 0;		while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && j++ < 20000);		pcb->data.raw[i++] = inb_command(dev->base_addr);		if (i > MAX_PCB_DATA)			INVALID_PCB_MSG(i);	} while ((stat & ASF_PCB_MASK) != ASF_PCB_END && j < 20000);	spin_unlock_irqrestore(&adapter->lock, flags);	if (j >= 20000) {		TIMEOUT_MSG(__LINE__);		return FALSE;	}	/* woops, the last "data" byte was really the length! */	total_length = pcb->data.raw[--i];	/* safety check total length vs data length */	if (total_length != (pcb->length + 2)) {		if (elp_debug >= 2)			printk(KERN_WARNING "%s: mangled PCB received/n", dev->name);		set_hsf(dev, HSF_PCB_NAK);		return FALSE;	}	if (pcb->command == CMD_RECEIVE_PACKET_COMPLETE) {		if (test_and_set_bit(0, (void *) &adapter->busy)) {			if (backlog_next(adapter->rx_backlog.in) == adapter->rx_backlog.out) {				set_hsf(dev, HSF_PCB_NAK);				printk(KERN_WARNING "%s: PCB rejected, transfer in progress and backlog full/n", dev->name);				pcb->command = 0;				return TRUE;			} else {				pcb->command = 0xff;			}		}	}	set_hsf(dev, HSF_PCB_ACK);	return TRUE;}
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:77,


示例26: elp_open

static int elp_open(struct net_device *dev){	elp_device *adapter;	int retval;	adapter = dev->priv;	if (elp_debug >= 3)		printk(KERN_DEBUG "%s: request to open device/n", dev->name);	/*	 * make sure we actually found the device	 */	if (adapter == NULL) {		printk(KERN_ERR "%s: Opening a non-existent physical device/n", dev->name);		return -EAGAIN;	}	/*	 * disable interrupts on the board	 */	outb_control(0, dev);	/*	 * clear any pending interrupts	 */	inb_command(dev->base_addr);	adapter_reset(dev);	/*	 * no receive PCBs active	 */	adapter->rx_active = 0;	adapter->busy = 0;	adapter->send_pcb_semaphore = 0;	adapter->rx_backlog.in = 0;	adapter->rx_backlog.out = 0;	spin_lock_init(&adapter->lock);	/*	 * install our interrupt service routine	 */	if ((retval = request_irq(dev->irq, &elp_interrupt, 0, dev->name, dev))) {		printk(KERN_ERR "%s: could not allocate IRQ%d/n", dev->name, dev->irq);		return retval;	}	if ((retval = request_dma(dev->dma, dev->name))) {		free_irq(dev->irq, dev);		printk(KERN_ERR "%s: could not allocate DMA%d channel/n", dev->name, dev->dma);		return retval;	}	adapter->dma_buffer = (void *) dma_mem_alloc(DMA_BUFFER_SIZE);	if (!adapter->dma_buffer) {		printk(KERN_ERR "%s: could not allocate DMA buffer/n", dev->name);		free_dma(dev->dma);		free_irq(dev->irq, dev);		return -ENOMEM;	}	adapter->dmaing = 0;	/*	 * enable interrupts on the board	 */	outb_control(CMDE, dev);	/*	 * configure adapter memory: we need 10 multicast addresses, default==0	 */	if (elp_debug >= 3)		printk(KERN_DEBUG "%s: sending 3c505 memory configuration command/n", dev->name);	adapter->tx_pcb.command = CMD_CONFIGURE_ADAPTER_MEMORY;	adapter->tx_pcb.data.memconf.cmd_q = 10;	adapter->tx_pcb.data.memconf.rcv_q = 20;	adapter->tx_pcb.data.memconf.mcast = 10;	adapter->tx_pcb.data.memconf.frame = 20;	adapter->tx_pcb.data.memconf.rcv_b = 20;	adapter->tx_pcb.data.memconf.progs = 0;	adapter->tx_pcb.length = sizeof(struct Memconf);	adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] = 0;	if (!send_pcb(dev, &adapter->tx_pcb))		printk(KERN_ERR "%s: couldn't send memory configuration command/n", dev->name);	else {		unsigned long timeout = jiffies + TIMEOUT;		while (adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] == 0 && time_before(jiffies, timeout));		if (time_after_eq(jiffies, timeout))			TIMEOUT_MSG(__LINE__);	}	/*	 * configure adapter to receive broadcast messages and wait for response	 */	if (elp_debug >= 3)		printk(KERN_DEBUG "%s: sending 82586 configure command/n", dev->name);	adapter->tx_pcb.command = CMD_CONFIGURE_82586;	adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD;	adapter->tx_pcb.length = 2;	adapter->got[CMD_CONFIGURE_82586] = 0;	if (!send_pcb(dev, &adapter->tx_pcb))//.........这里部分代码省略.........
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:101,


示例27: consider_steal_time

static unsigned longconsider_steal_time(unsigned long new_itm){	unsigned long stolen, blocked;	unsigned long delta_itm = 0, stolentick = 0;	int cpu = smp_processor_id();	struct vcpu_runstate_info runstate;	struct task_struct *p = current;	get_runstate_snapshot(&runstate);	/*	 * Check for vcpu migration effect	 * In this case, itc value is reversed.	 * This causes huge stolen value.	 * This function just checks and reject this effect.	 */	if (!time_after_eq(runstate.time[RUNSTATE_blocked],			   per_cpu(xen_blocked_time, cpu)))		blocked = 0;	if (!time_after_eq(runstate.time[RUNSTATE_runnable] +			   runstate.time[RUNSTATE_offline],			   per_cpu(xen_stolen_time, cpu)))		stolen = 0;	if (!time_after(delta_itm + new_itm, ia64_get_itc()))		stolentick = ia64_get_itc() - new_itm;	do_div(stolentick, NS_PER_TICK);	stolentick++;	do_div(stolen, NS_PER_TICK);	if (stolen > stolentick)		stolen = stolentick;	stolentick -= stolen;	do_div(blocked, NS_PER_TICK);	if (blocked > stolentick)		blocked = stolentick;	if (stolen > 0 || blocked > 0) {		account_steal_ticks(stolen);		account_idle_ticks(blocked);		run_local_timers();		rcu_check_callbacks(cpu, user_mode(get_irq_regs()));		scheduler_tick();		run_posix_cpu_timers(p);		delta_itm += local_cpu_data->itm_delta * (stolen + blocked);		if (cpu == time_keeper_id)			xtime_update(stolen + blocked);		local_cpu_data->itm_next = delta_itm + new_itm;		per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen;		per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked;	}	return delta_itm;}
开发者ID:007kumarraja,项目名称:rockchip-rk3188-mk908,代码行数:64,



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


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