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


C++ pn544_disable_irq函数代码示例

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


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

示例1: pn544_dev_read

static ssize_t pn544_dev_read(struct file *filp, char __user *buf,
		size_t count, loff_t *offset)
{
	struct pn544_dev *pn544_dev = filp->private_data;
	char tmp[MAX_BUFFER_SIZE];
	int ret, i;

	if (count > MAX_BUFFER_SIZE)
		count = MAX_BUFFER_SIZE;

	mutex_lock(&pn544_dev->read_mutex);

	if (!gpio_get_value(pn544_dev->irq_gpio)) {
		if (filp->f_flags & O_NONBLOCK) {
			ret = -EAGAIN;
			goto fail;
		}

		pn544_dev->irq_enabled = true;
		enable_irq(pn544_dev->client->irq);
		ret = wait_event_interruptible(pn544_dev->read_wq,
				gpio_get_value(pn544_dev->irq_gpio));

		pn544_disable_irq(pn544_dev);

		if (ret)
			goto fail;
	}

	/* Read data */
	ret = i2c_master_recv(pn544_dev->client, tmp, count);
	mutex_unlock(&pn544_dev->read_mutex);

	if (ret < 0) {
		pr_err("%s: i2c_master_recv returned %d\n", __func__, ret);
		return ret;
	}
	if (ret > count) {
		pr_err("%s: received too many bytes from i2c (%d)\n",
			__func__, ret);
		return -EIO;
	}
	if (copy_to_user(buf, tmp, ret)) {
		pr_warning("%s : failed to copy to user space\n", __func__);
		return -EFAULT;
	}
	for(i = 0; i < ret; i++){
		printk(" %02X", tmp[i]);
	}

	return ret;

fail:
	mutex_unlock(&pn544_dev->read_mutex);
	return ret;
}
开发者ID:Nokius,项目名称:android_kernel_yotaphone2,代码行数:56,代码来源:pn544.c

示例2: pn544_i2c_read

static int pn544_i2c_read(int count)
{
	char tmp[MAX_BUFFER_SIZE];
	int ret, i;

	if (!gpio_get_value(pn544_dev->irq_gpio)) {
		enable_irq(pn544_dev->client->irq);
		ret = wait_event_interruptible(pn544_dev->read_wq, gpio_get_value(pn544_dev->irq_gpio));
		pn544_disable_irq(pn544_dev);
		if (ret){
			printk("[Nfc]wait_event_interruptible() fails");
			goto fail;
		}
 	}

	/* Read data */
	for(i=0; i<2; i++) {
		ret = i2c_master_recv(pn544_dev->client, tmp, count);

		/* pn544 seems to be slow in handling I2C read requests
		 * so add 1ms delay after recv operation */
		udelay(1000);
	
		if (ret < 0) {
			printk("%s: i2c_master_recv returned %d\n", __func__, ret);
 		}
		else if (ret > count) {
			printk("%s: received too many bytes from i2c (%d)\n", __func__, ret);
 		}
		else {
			return I2C_TEST_PASS;
		}

		printk("[NFC] i2c_master_recv() retry....%d\n", i);
	}

	//printk("%s : reading %zu bytes.\n", __func__, count);

	#if 0
	printk("[Nfc]Received Data:\n");
	for (i = 1; i < count; i++) {
		printk("0x%02x, ", tmp[i] );
	}
	printk("\n");
	#endif
	/*if (copy_to_user(buf, tmp, ret)) {
		pr_warning("%s : failed to copy to user space\n", __func__);
		return -EFAULT;
 	}*/

fail:
	return I2C_TEST_NFC_FAIL;

}
开发者ID:blackjack4it,项目名称:android_kernel_asus_padfone_s,代码行数:54,代码来源:pn65n.c

示例3: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;

	pn544_disable_irq(pn544_dev);

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:itsmerajit,项目名称:kernel_otus,代码行数:11,代码来源:pn544-mot.c

示例4: __pn544_kread

static int __pn544_kread(void *dev, unsigned int length)
{
    struct pn544_dev *pn544_dev = NULL;
    char tmp[MAX_BUFFER_SIZE];
    int ret = 0;
    int irq_gpio_val = 0;

    if(dev != NULL)
        pn544_dev = (struct pn544_dev*)dev;

    mutex_lock(&pn544_dev->read_mutex);

    irq_gpio_val = gpio_get_value(pn544_dev->irq_gpio);
    pr_debug(PN544_DRV_NAME ":IRQ GPIO = %d\n", irq_gpio_val);
    if (irq_gpio_val == 0) {
        pn544_dev->irq_enabled = true;
#ifdef READ_IRQ_MODIFY
        do_reading=0;//DY_TEST
#endif
      //  enable_irq_wake(pn544_dev->client->irq);
     //   enable_irq(pn544_dev->client->irq);
        enable_irq_wake(OMAP_GPIO_IRQ(pn544_dev->irq_gpio));
        enable_irq(OMAP_GPIO_IRQ(pn544_dev->irq_gpio));
#ifdef READ_IRQ_MODIFY
        ret = wait_event_interruptible(pn544_dev->read_wq, do_reading);
#else
        ret = wait_event_interruptible(pn544_dev->read_wq, gpio_get_value(pn544_dev->irq_gpio));
#endif
        pn544_disable_irq(pn544_dev);
        if(ret)
            goto fail;
    }    
    memset(tmp, 0x00, MAX_BUFFER_SIZE);
    ret = i2c_master_recv(pn544_dev->client, tmp, length);
    while(tmp[0]==0x51&&tmp[1]==0xFF&&tmp[2]==0xFF){
        ret = i2c_master_recv(pn544_dev->client, tmp, length);
        printk("%s read retry!\n", __func__);
    }
    mutex_unlock(&pn544_dev->read_mutex);
    printk("[seokmin] read data : 0x%X 0x%X 0x%X 0x%X\n", tmp[0], tmp[1], tmp[2], tmp[3]);
    if (ret < 0) {
        dprintk("%s: i2c_master_recv returned %d\n", __func__, ret);
        return ret;
    }
    if (ret > length) {
        dprintk("%s: received too many bytes from i2c (%d)\n", __func__);
        return -EIO;
    }
   
fail:
    mutex_unlock(&pn544_dev->read_mutex);
    return ret;
}
开发者ID:eklovya,项目名称:android_kernel_lge_p725,代码行数:53,代码来源:pn544_lge.c

示例5: pn544_irq_thread_fn

/* this function is used the irq handler*/
static irqreturn_t pn544_irq_thread_fn(int irq, void *dev_id) 
{ 
	PN544_DEBUG("%s:enter\n",__func__);

	pn544_disable_irq(pn544_info);
	pn544_info->read_irq = PN544_INT;
	
	/* Wake up waiting readers */
	wake_up(&pn544_info->read_wait);
	
	return IRQ_HANDLED;

} 
开发者ID:agrloki,项目名称:CeXstel-kernel-msm8x25,代码行数:14,代码来源:pn544.c

示例6: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;
	pr_info("[%s] in!\n", __func__);
	pn544_disable_irq(pn544_dev);
#ifdef READ_IRQ_MODIFY
	do_reading=1;//DY_TEST
#endif

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:eklovya,项目名称:android_kernel_lge_p725,代码行数:14,代码来源:pn544_lge.c

示例7: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;
	
	if (!gpio_get_value(pn544_dev->irq_gpio)) {
		return IRQ_HANDLED;
	}

	pn544_disable_irq(pn544_dev);

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);
    printk("%s : IRQ trigger!\n", __func__);
	return IRQ_HANDLED;
}
开发者ID:phenomx4,项目名称:android_kernel_n9510_n9520,代码行数:15,代码来源:pn544.c

示例8: pn544_remove

static int pn544_remove(struct i2c_client *client)
{
	pn544_dev = i2c_get_clientdata(client);
	pn544_disable_irq(pn544_dev);
	free_irq(client->irq, pn544_dev);
	misc_deregister(&pn544_dev->pn544_device);
	mutex_destroy(&pn544_dev->read_mutex);
	gpio_free(pn544_dev->irq_gpio);
	gpio_free(pn544_dev->ven_gpio);
	gpio_free(pn544_dev->firm_gpio);
	kfree(pn544_dev);
	pn544_dev = NULL;

	return 0;
}
开发者ID:Nokius,项目名称:android_kernel_yotaphone2,代码行数:15,代码来源:pn544.c

示例9: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;

	dprintk(PN544_DRV_NAME ":pn544_dev_irq_handler : %d\n", irq);

	pn544_disable_irq(pn544_dev);
#ifdef LGE_NFC_READ_IRQ_MODIFY
	do_reading=1;//DY_TEST
#endif

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:Ntemis,项目名称:LG_X3_P880_v20a,代码行数:16,代码来源:pn544_lge.c

示例10: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;

	pn544_disable_irq(pn544_dev);
#ifdef FEATURE_PN544_KERNEL_LOG
    pr_info("==> %s (ven, firm, irq)=(%d, %d, %d)\n", __func__, gpio_get_value(pn544_dev->ven_gpio), gpio_get_value(pn544_dev->firm_gpio), gpio_get_value(pn544_dev->irq_gpio));
#endif
#ifdef READ_IRQ_MODIFY
	do_reading=1;
#endif
	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:phuthinh100,项目名称:Kernel-JB--sky-A830L,代码行数:16,代码来源:pn544.c

示例11: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;

	pn544_disable_irq(pn544_dev);
#ifdef NXP_KR_PENDING_READ
	irq_nfc = true;
#endif
#if 0 //def FEATURE_PN544_KERNEL_LOG
     pr_info("==> %s (ven, firm, irq)=(%d, %d, %d) \n", __func__, VEN_GET_VALUE(pn544_dev->ven_gpio), FW_DL_GET_VALUE(pn544_dev->firm_gpio), gpio_get_value(pn544_dev->irq_gpio));
#endif

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:CM11MOD,项目名称:android_kernel_pantech_ef60s,代码行数:17,代码来源:pn544.c

示例12: pn544_dev_irq_handler

static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
{
	struct pn544_dev *pn544_dev = dev_id;

//FIH-SW2-PERIPHERAL-BJ-NFC_Porting-00+[
	if (!gpio_get_value(pn544_dev->irq_gpio)) 
	{
		return IRQ_HANDLED;
	}
//FIH-SW2-PERIPHERAL-BJ-NFC_Porting-00+]

	pn544_disable_irq(pn544_dev);

	/* Wake up waiting readers */
	wake_up(&pn544_dev->read_wq);

	return IRQ_HANDLED;
}
开发者ID:Zoldyck07,项目名称:SXDNickiSS,代码行数:18,代码来源:pn544.c

示例13: pn544_remove

static int pn544_remove(struct i2c_client *client)
{
	printk("pn544_remove start\n");
	pmu_disable();
	pn544_dev = i2c_get_clientdata(client);
	pn544_disable_irq(pn544_dev);
	free_irq(client->irq, pn544_dev);
	misc_deregister(&pn544_dev->pn544_device);
	mutex_destroy(&pn544_dev->read_mutex);
//	wake_lock_destroy(&pn544_dev->wl);//FIXED Screen off transcation proformance issue
	gpio_free(pn544_dev->irq_gpio);
	gpio_free(pn544_dev->ven_gpio);
	gpio_free(pn544_dev->firm_gpio);
	kfree(pn544_dev);
	pn544_dev = NULL;
	printk("pn544_remove end\n");

	return 0;
}
开发者ID:moonlightly,项目名称:NX523J_kernel,代码行数:19,代码来源:pn547.c

示例14: pn544_dev_read

static ssize_t pn544_dev_read(struct file *filp, char __user *buf,
		size_t count, loff_t *offset)
{
	struct pn544_dev *pn544_dev = filp->private_data;
	char *data;
	int ret;
	int tries = 0;

	data = kzalloc(count, GFP_KERNEL);
	if (!data) {
		pr_err("%s: could not allocate buffer\n", __func__);
		return -ENOMEM;
	}

	pr_debug("%s : reading %zu bytes.\n", __func__, count);

	mutex_lock(&pn544_dev->read_mutex);

	if (!gpio_get_value(pn544_dev->irq_gpio)) {
		if (filp->f_flags & O_NONBLOCK) {
			ret = -EAGAIN;
			mutex_unlock(&pn544_dev->read_mutex);
			goto free_buf;
		}

		pn544_dev->irq_enabled = true;
		irq_set_irq_wake(pn544_dev->client->irq, 1);
		enable_irq(pn544_dev->client->irq);
		ret = wait_event_interruptible(pn544_dev->read_wq,
				gpio_get_value(pn544_dev->irq_gpio));

		pn544_disable_irq(pn544_dev);

		if (ret) {
			mutex_unlock(&pn544_dev->read_mutex);
			goto free_buf;
		}

	}

	/* Read data */
	do {
		ret = i2c_master_recv(pn544_dev->client, data, count);
		if (ret < 0)
			msleep_interruptible(5);
	} while ((ret < 0) && (++tries < 5));

	mutex_unlock(&pn544_dev->read_mutex);

	if (ret < 0) {
		pr_err("%s: i2c_master_recv failed, returned %d\n",
			__func__, ret);
		goto free_buf;
	}

	if (copy_to_user(buf, data, count)) {
		pr_err("%s : failed to copy to user space\n", __func__);
		ret = -EFAULT;
	}

free_buf:
	kfree(data);
	return ret;
}
开发者ID:itsmerajit,项目名称:kernel_otus,代码行数:64,代码来源:pn544-mot.c

示例15: pn544_probe


//.........这里部分代码省略.........
	if (pn544_dev == NULL) {
		dev_err(&client->dev,
				"failed to allocate memory for module data\n");
		ret = -ENOMEM;
		goto err_exit;
	}

	ret = pn544_gpio_init(platform_data);
	if (ret) {
		dev_err(&client->dev, "gpio init failed\n");
		goto err_gpio_init;
	}

	pn544_dev->irq_gpio = platform_data->irq_gpio;
	pn544_dev->ven_gpio  = platform_data->ven_gpio;
	pn544_dev->firmware_gpio = platform_data->firmware_gpio;
	pn544_dev->ven_polarity = platform_data->ven_polarity;
	pn544_dev->discharge_delay = platform_data->discharge_delay;
	pn544_dev->client   = client;

	pn544_dev->vdd = regulator_get(&client->dev, "vdd");
	if (IS_ERR(pn544_dev->vdd)) {
		dev_info(&client->dev, "vdd regulator control absent\n");
		pn544_dev->vdd = NULL;
	}
	if (pn544_dev->vdd != NULL) {
		regulator_set_voltage(pn544_dev->vdd, 2950000, 2950000);
		ret = regulator_enable(pn544_dev->vdd);
		if (ret < 0) {
			dev_err(&client->dev, "Error enabling vddswp regulator\n");
			goto err_en_regulator_swp;
		}
	}

	/* init mutex and queues */
	init_waitqueue_head(&pn544_dev->read_wq);
	mutex_init(&pn544_dev->read_mutex);
	spin_lock_init(&pn544_dev->irq_enabled_lock);

	pn544_dev->pn544_device.minor = MISC_DYNAMIC_MINOR;
	pn544_dev->pn544_device.name = "pn544";
	pn544_dev->pn544_device.fops = &pn544_dev_fops;

	ret = misc_register(&pn544_dev->pn544_device);
	if (ret) {
		pr_err("%s : misc_register failed.\n", __FILE__);
		goto err_misc_register;
	}

	pr_debug("%s : PN544 Misc Minor: %d\n",
		__func__, pn544_dev->pn544_device.minor);

	/* Get the device structure */
	pn544_dev->pn544_control_device = pn544_dev->pn544_device.this_device;

	/* Create sysfs device for PN544 control functionality */
	ret = device_create_file(pn544_dev->pn544_control_device,
				&dev_attr_pn544_control_dev);
	if (ret) {
		pr_err("%s : device_create_file failed\n", __FILE__);
		goto err_device_create_file_failed;
	}

	/* request irq.  the irq is set whenever the chip has data available
	 * for reading.  it is cleared when all data has been read.
	 */
	pr_debug("%s : requesting IRQ %d\n", __func__, client->irq);
	pn544_dev->irq_enabled = true;
	ret = request_irq(client->irq, pn544_dev_irq_handler,
			  IRQF_TRIGGER_HIGH, client->name, pn544_dev);
	if (ret) {
		dev_err(&client->dev, "request_irq failed\n");
		goto err_request_irq_failed;
	}
	if (unlikely(irq_set_irq_wake(client->irq, 1)))
		pr_err("%s : unable to make irq %d wakeup\n", __func__,
					client->irq);
	pn544_disable_irq(pn544_dev);
	i2c_set_clientdata(client, pn544_dev);

	return 0;

err_request_irq_failed:
	device_remove_file(pn544_dev->pn544_control_device,
				&dev_attr_pn544_control_dev);
err_device_create_file_failed:
	misc_deregister(&pn544_dev->pn544_device);
err_misc_register:
	mutex_destroy(&pn544_dev->read_mutex);
	pn544_gpio_free(pn544_dev);
	if (pn544_dev->vdd != NULL)
		regulator_disable(pn544_dev->vdd);
err_en_regulator_swp:
	if (pn544_dev->vdd != NULL)
		regulator_put(pn544_dev->vdd);
err_gpio_init:
	kfree(pn544_dev);
err_exit:
	return ret;
}
开发者ID:itsmerajit,项目名称:kernel_otus,代码行数:101,代码来源:pn544-mot.c


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