static ssize_t uart_write(struct file *filp,char *buf,size_t count,loff_t *f_pos) { int i; char tx_buf[BUFFSIZE]; unsigned char lsr; // size_t tx_buf_count=0; struct inode *inode =filp->private_data; printk("<1>uart_write MINOR = %d,filp->f_count is %d
",MINOR(inode->i_rdev),filp->f_count); copy_from_user(tx_buf,buf,count); for(i=0;i<count;i++) { while(!(lsr=readb(vEXT_COM_BASE_ADDR[MINOR(inode->i_rdev)]+LSR)&(0x1<<5))); writeb(tx_buf,vEXT_COM_BASE_ADDR[MINOR(inode->i_rdev)]+THR); } return count; }
static struct file_operations uart_fops= { owner: THIS_MODULE, read: uart_read, write: uart_write, //125行 open: uart_open, release: uart_release, flush: uart_flush, ioctl: uart_ioctl, };
编译时 125行有警告:warning: initialization from incompatible pointer type
想了很久 也不知道问题出在哪里 read 和write的函数差不多 为什么read不出问题而write就有呢 各位大虾帮帮忙 谢谢
|