初级会员
- 积分
- 143
- 金钱
- 143
- 注册时间
- 2019-10-23
- 在线时间
- 42 小时
|
楼主 |
发表于 2021-3-12 14:57:18
|
显示全部楼层
我使用的驱动程序 init
- major = register_chrdev(0, devname, &irq_fops);
-
- cls = class_create(THIS_MODULE, devname);
- mijor = 1;
- tmp_dev = device_create(cls, &pdev->dev, MKDEV(major, mijor), NULL, devname);
- if (IS_ERR(tmp_dev)) {
- class_destroy(cls);
- unregister_chrdev(major, devname);
- return 0;
- }
-
- irq = platform_get_irq(pdev,0);
- if (irq <= 0)
- return -ENXIO;
-
- dev = &pdev->dev;
-
- // err = request_threaded_irq(irq, NULL,
- // irq_interrupt,
- // IRQF_TRIGGER_RISING | IRQF_ONESHOT,
- // devname, NULL);
- err = request_irq(irq,
- irq_interrupt,
- IRQF_TRIGGER_RISING,
- devname, NULL);
复制代码 |
|