设备驱动程序案例一研讨.ppt

设备驱动程序案例一研讨

* spioc_read() static ssize_t spioc_read(struct file *filp, char *buf, size_t cnt, loff_t *off) { if(count cnt) cnt = count; if(cnt) copy_to_user(buf, rbuff, cnt); return cnt; } * spioc_write() static ssize_t spioc_write(struct file *filp, const char *buf, size_t cnt, loff_t *off) { if(cnt 64) cnt = 64; copy_from_user(wbuff, buf, cnt); count = cnt; return cnt; } * spioc_ioctl() static int spioc_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { switch(cmd) { default: break; } return 0; } * spioc_fops static struct file_operations s

文档评论(0)

1亿VIP精品文档

相关文档