【文件属性】:
文件名称:混杂设备驱动框架-卷积神经网络的数学推导
文件大小:8.6MB
文件格式:PDF
更新时间:2024-06-29 07:17:46
周立功 嵌入式 Linux
程序清单 2.27 混杂设备驱动框架
1 #include
2 #include
3 #include
4 #include
5
6 #define DEVICE_NAME "char_misc"
7
8 static int char_misc_open(struct inode *inode, struct file *file )
9 {
10 try_module_get(THIS_MODULE);
11 printk(KERN_INFO DEVICE_NAME "opened!\n");
12 return 0;
13 }
14
15 static int char_misc_release(struct inode *inode, struct file *file )
16 {
17 printk(KERN_INFO DEVICE_NAME "closed!\n");
18 module_put(THIS_MODULE);
19 return 0;
20 }
21
22 static ssize_t char_misc_read(struct file *file, char *buf,size_t count, loff_t *f_pos)
23 {
24 printk(KERN_INFO DEVICE_NAME "read method!\n");
25 return count;
26 }
27
28 static ssize_t char_misc_write(struct file *file, const char *buf, size_t count, loff_t *f_pos)
29 {
30 printk(KERN_INFO DEVICE_NAME "write method!\n");
31 return count;
32 }
33
34 static int char_misc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
35 {
36 printk(KERN_INFO DEVICE_NAME "ioctl method!\n");
37 return 0;
38 }
39