当前位置: 首页>>代码示例>>C++>>正文


C++ schedule_timeout_interruptible函数代码示例

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


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

示例1: esas2r_flash_access

static bool esas2r_flash_access(struct esas2r_adapter *a, u32 function)
{
	u32 starttime;
	u32 timeout;
	u32 intstat;
	u32 doorbell;

	/* Disable chip interrupts awhile */
	if (function == DRBL_FLASH_REQ)
		esas2r_disable_chip_interrupts(a);

	/* Issue the request to the firmware */
	esas2r_write_register_dword(a, MU_DOORBELL_IN, function);

	/* Now wait for the firmware to process it */
	starttime = jiffies_to_msecs(jiffies);
	timeout = a->flags &
		  (AF_CHPRST_PENDING | AF_DISC_PENDING) ? 40000 : 5000;

	while (true) {
		intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT);

		if (intstat & MU_INTSTAT_DRBL) {
			/* Got a doorbell interrupt.  Check for the function */
			doorbell =
				esas2r_read_register_dword(a, MU_DOORBELL_OUT);
			esas2r_write_register_dword(a, MU_DOORBELL_OUT,
						    doorbell);
			if (doorbell & function)
				break;
		}

		schedule_timeout_interruptible(msecs_to_jiffies(100));

		if ((jiffies_to_msecs(jiffies) - starttime) > timeout) {
			/*
			 * Iimeout.  If we were requesting flash access,
			 * indicate we are done so the firmware knows we gave
			 * up.  If this was a REQ, we also need to re-enable
			 * chip interrupts.
			 */
			if (function == DRBL_FLASH_REQ) {
				esas2r_hdebug("flash access timeout");
				esas2r_write_register_dword(a, MU_DOORBELL_IN,
							    DRBL_FLASH_DONE);
				esas2r_enable_chip_interrupts(a);
			} else {
				esas2r_hdebug("flash release timeout");
			}

			return false;
		}
	}

	/* if we're done, re-enable chip interrupts */
	if (function == DRBL_FLASH_DONE)
		esas2r_enable_chip_interrupts(a);

	return true;
}
开发者ID:andrewgreen5610,项目名称:linux,代码行数:60,代码来源:esas2r_flash.c

示例2: log_worker

static int log_worker(void *p)
{
	/* The thread should have never started */
	if (log_buf == NULL)
		return -EFAULT;

	while (!kthread_should_stop()) {
		if (log_buf->write_pos == log_pos)
			schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);

		switch (log_buf->version) {
		case 1:
			log_pos = process_v1log();
			break;
		case 2:
			log_pos = process_v2log();
			break;
		default:
			MCDRV_DBG_ERROR("Unknown Mobicore log data "
				"version %d logging disabled.",
				log_buf->version);
			log_pos = log_buf->write_pos;
			/* Stop the thread as we have no idea what
			 * happens next */
			return -EFAULT;
		}
	}
	MCDRV_DBG("Logging thread stopped!");
	return 0;
}
开发者ID:jspschool,项目名称:tee-mobicore-driver.kernel,代码行数:30,代码来源:logging.c

示例3: compat_nanosleep_restart

static long compat_nanosleep_restart(struct restart_block *restart)
{
    unsigned long expire = restart->arg0, now = jiffies;
    struct compat_timespec __user *rmtp;

    /* Did it expire while we handled signals? */
    if (!time_after(expire, now))
        return 0;

    expire = schedule_timeout_interruptible(expire - now);
    if (expire == 0)
        return 0;

    rmtp = (struct compat_timespec __user *)restart->arg1;
    if (rmtp) {
        struct compat_timespec ct;
        struct timespec t;

        jiffies_to_timespec(expire, &t);
        ct.tv_sec = t.tv_sec;
        ct.tv_nsec = t.tv_nsec;
        if (copy_to_user(rmtp, &ct, sizeof(ct)))
            return -EFAULT;
    }
    /* The 'restart' block is already filled in */
    return -ERESTART_RESTARTBLOCK;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:27,代码来源:compat.c

示例4: bt866_write

static int bt866_write(struct bt866 *encoder,
			unsigned char subaddr, unsigned char data)
{
	unsigned char buffer[2];
	int err;

	buffer[0] = subaddr;
	buffer[1] = data;

	encoder->reg[subaddr] = data;

	DEBUG(printk
	      ("%s: write 0x%02X = 0x%02X\n",
	       encoder->i2c->name, subaddr, data));

	for (err = 0; err < 3;) {
		if (i2c_master_send(encoder->i2c, buffer, 2) == 2)
			break;
		err++;
		printk(KERN_WARNING "%s: I/O error #%d "
		       "(write 0x%02x/0x%02x)\n",
		       encoder->i2c->name, err, encoder->addr, subaddr);
		schedule_timeout_interruptible(msecs_to_jiffies(100));
	}
	if (err == 3) {
		printk(KERN_WARNING "%s: giving up\n",
		       encoder->i2c->name);
		return -1;
	}

	return 0;
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:32,代码来源:bt866.c

示例5: compat_sys_nanosleep

asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
                                     struct compat_timespec __user *rmtp)
{
    struct timespec t;
    struct restart_block *restart;
    unsigned long expire;

    if (get_compat_timespec(&t, rqtp))
        return -EFAULT;

    if ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0))
        return -EINVAL;

    expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
    expire = schedule_timeout_interruptible(expire);
    if (expire == 0)
        return 0;

    if (rmtp) {
        jiffies_to_timespec(expire, &t);
        if (put_compat_timespec(&t, rmtp))
            return -EFAULT;
    }
    restart = &current_thread_info()->restart_block;
    restart->fn = compat_nanosleep_restart;
    restart->arg0 = jiffies + expire;
    restart->arg1 = (unsigned long) rmtp;
    return -ERESTART_RESTARTBLOCK;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:29,代码来源:compat.c

示例6: kthread_init

static int __init kthread_init()
{
    int cpu;
    unsigned int cpu_count = num_online_cpus();
    unsigned int parameter[cpu_count];
    struct task_struct *t_thread[cpu_count];

    for_each_present_cpu(cpu) {
        parameter[cpu] = cpu;
        
        t_thread[cpu] = kthread_create(mythread, (void *)(parameter + cpu), "thread/%d", cpu);

        if (IS_ERR(t_thread[cpu])) {
            printk(KERN_ERR "[thread/%d]: creating kthread failed \n", cpu);
            goto out;
        }
        kthread_bind(t_thread[cpu], cpu);
        wake_up_process(t_thread[cpu]);
    }
    schedule_timeout_interruptible(msecs_to_jiffies(sleep_millisecs));
    
    for (cpu = 0; cpu < cpu_count; cpu++) {
        kthread_stop(t_thread[cpu]);
    }
out:
    return 0;
}
开发者ID:coperd,项目名称:lkm,代码行数:27,代码来源:kernel_thread.c

示例7: usb_serial_generic_wait_until_sent

void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
{
	struct usb_serial_port *port = tty->driver_data;
	unsigned int bps;
	unsigned long period;
	unsigned long expire;

	bps = tty_get_baud_rate(tty);
	if (!bps)
		bps = 9600;	/* B0 */
	/*
	 * Use a poll-period of roughly the time it takes to send one
	 * character or at least one jiffy.
	 */
	period = max_t(unsigned long, (10 * HZ / bps), 1);
	period = min_t(unsigned long, period, timeout);

	dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
					__func__, jiffies_to_msecs(timeout),
					jiffies_to_msecs(period));
	expire = jiffies + timeout;
	while (!port->serial->type->tx_empty(port)) {
		schedule_timeout_interruptible(period);
		if (signal_pending(current))
			break;
		if (time_after(jiffies, expire))
			break;
	}
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:29,代码来源:generic.c

示例8: usbrh_disconnect

static void usbrh_disconnect(struct usb_interface *interface)
{
    struct usbrh *dev;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
    while(!mutex_lock_interruptible(&usbrh_ioctl_mutex)) {
    	schedule_timeout_interruptible(msecs_to_jiffies(100));
    }
#else
    lock_kernel();
#endif

    dev = usb_get_intfdata(interface);
    usb_set_intfdata(interface, NULL);

    usb_deregister_dev(interface, &usbrh_class);

    mutex_lock(&dev->io_mutex);
    dev->interface = NULL;
    mutex_unlock(&dev->io_mutex);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
    mutex_unlock(&usbrh_ioctl_mutex);
#else
    unlock_kernel();
#endif

    kref_put(&dev->kref, usbrh_delete);

    info("USBRH disconnected");
}
开发者ID:tochiz,项目名称:usbrh,代码行数:31,代码来源:usbrh.c

示例9: wait_for_devices

/*
 * On a 5-minute timeout, wait for all devices currently configured.  We need
 * to do this to guarantee that the filesystems and / or network devices
 * needed for boot are available, before we can allow the boot to proceed.
 *
 * This needs to be on a late_initcall, to happen after the frontend device
 * drivers have been initialised, but before the root fs is mounted.
 *
 * A possible improvement here would be to have the tools add a per-device
 * flag to the store entry, indicating whether it is needed at boot time.
 * This would allow people who knew what they were doing to accelerate their
 * boot slightly, but of course needs tools or manual intervention to set up
 * those flags correctly.
 */
static void wait_for_devices(struct xenbus_driver *xendrv)
{
	unsigned long start = jiffies;
	struct device_driver *drv = xendrv ? &xendrv->driver : NULL;
	unsigned int seconds_waited = 0;

	if (!ready_to_wait_for_devices || !xen_domain())
		return;

	while (exists_connecting_device(drv)) {
		if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
			if (!seconds_waited)
				printk(KERN_WARNING "XENBUS: Waiting for "
				       "devices to initialise: ");
			seconds_waited += 5;
			printk("%us...", 300 - seconds_waited);
			if (seconds_waited == 300)
				break;
		}

		schedule_timeout_interruptible(HZ/10);
	}

	if (seconds_waited)
		printk("\n");

	bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
			 print_device_status);
}
开发者ID:303750856,项目名称:linux-3.1,代码行数:43,代码来源:xenbus_probe_frontend.c

示例10: long_sleep

/* sleeps that many milliseconds with a reschedule */
static void long_sleep(int ms)
{
	if (in_interrupt())
		mdelay(ms);
	else
		schedule_timeout_interruptible(msecs_to_jiffies(ms));
}
开发者ID:CCNITSilchar,项目名称:linux,代码行数:8,代码来源:charlcd.c

示例11: usleep

static void usleep(unsigned int usecs)
{
        unsigned long timeout = usecs_to_jiffies(usecs);

        while (timeout)
                timeout = schedule_timeout_interruptible(timeout);
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:7,代码来源:ralink_spi.c

示例12: qm_sleep

static void
qm_sleep(PT3_QM *qm, PT3_BUS *bus, __u32 ms)
{
	if (bus)
		pt3_bus_sleep(bus, ms);
	else 
		schedule_timeout_interruptible(msecs_to_jiffies(ms));	
}
开发者ID:knight-rider,项目名称:ptx,代码行数:8,代码来源:pt3_qm.c

示例13: wavefront_sleep

static int
wavefront_sleep (int limit)

{
	schedule_timeout_interruptible(limit);

	return signal_pending(current);
}
开发者ID:A-K,项目名称:linux,代码行数:8,代码来源:wavefront_synth.c

示例14: pt3_mx_set_frequency

STATUS
pt3_mx_set_frequency(PT3_MX *mx, __u32 channel, __s32 offset)
{
	STATUS status;
	int catv, locked1, locked2;
	__u32 number, freq;
	__u32 real_freq;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
	struct timeval begin, now;
#else
	struct timespec64 begin, now;
#endif

	status = pt3_tc_set_agc_t(mx->tc, NULL, PT3_TC_AGC_MANUAL);
	if (status)
		return status;
	
	pt3_mx_get_channel_frequency(mx, channel, &catv, &number, &freq);

	//real_freq = (7 * freq + 1 + offset) * 1000000.0 /7.0;
	real_freq = REAL_TABLE[channel];

	mx_set_frequency(mx, NULL, real_freq);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
	do_gettimeofday(&begin);
#else
	ktime_get_real_ts64(&begin);
#endif
	locked1 = locked2 = 0;
	while (1) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
		do_gettimeofday(&now);
#else
		ktime_get_real_ts64(&now);
#endif
		pt3_mx_get_locked1(mx, NULL, &locked1);
		pt3_mx_get_locked2(mx, NULL, &locked2);

		if (locked1 && locked2)
			break;
		if (time_diff(&begin, &now) > 1000)
			break;

		schedule_timeout_interruptible(msecs_to_jiffies(1));	
	}
#if 0
	PT3_PRINTK(7, KERN_DEBUG, "mx_get_locked1 %d locked2 %d\n", locked1, locked2);
#endif
	if (!(locked1 && locked2))
		return STATUS_PLL_LOCK_TIMEOUT_ERROR;
	
	status = pt3_tc_set_agc_t(mx->tc, NULL, PT3_TC_AGC_AUTO);
	if (status)
		return status;

	return status;
}
开发者ID:m-tsudo,项目名称:pt3,代码行数:58,代码来源:pt3_mx.c

示例15: efx_ethtool_phys_id

/* Identify device by flashing LEDs */
static int efx_ethtool_phys_id(struct net_device *net_dev, u32 seconds)
{
    struct efx_nic *efx = net_dev->priv;

    efx->board_info.blink(efx, 1);
    schedule_timeout_interruptible(seconds * HZ);
    efx->board_info.blink(efx, 0);
    return 0;
}
开发者ID:274914765,项目名称:C,代码行数:10,代码来源:ethtool.c


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