摘要: #include <linux/module.h>#include <linux/kernel.h>#include <linux/fs.h>#include <linux/device.h>#include <asm/io.h> static struct class* aes_driver_class = NULL; static struct device* aes_driver_device = NULL; unsigned long aes_slave_reg0_addr = 0; //aes moulde's fr 阅读全文
posted @ 2013-04-09 14:59 puckpuck 阅读(193) 评论(0) 推荐(0) 编辑
摘要: static int my_ioctl(struct file *filp, unsigned int reg_num, unsigned long arg){if(reg_num>=0&&reg_num<=8){iowrite32(arg,aes_slave_reg0_addr+reg_num*4);prink("write0x% xto0x% x!\n",arg,aes_slave_reg0_addr+reg_num*4);}else prink("wrong reg num");return 0;}static ssiz 阅读全文
posted @ 2013-04-09 14:46 puckpuck 阅读(186) 评论(0) 推荐(0) 编辑
摘要: static ssize_t myread(struct file*file,char *data,size_t count,loff_t *offp){ if(filp->f_flags &O_NONBLOCK) return -EAGAIN; int tmp[4]; tmp[0] =ioread32(aes_slave_reg5_addr) ;//AXI_AES_IP_mReadSlaveReg5(X_BASE,0); tmp[1] =ioread32(aes_slave_reg6_addr) ;//AAXI_AES_... 阅读全文
posted @ 2013-04-09 10:59 puckpuck 阅读(467) 评论(0) 推荐(0) 编辑
摘要: file_operations结构体中,会看到许多函数指针所指向的函数都必须传进structfile结构体指针structfile*作为参数。structfile结构体定义在<linux/fs.h>中,完整如下:引用structfile{union{structlist_headfu_list;structrcu_headfu_rcuhead;}f_u;structpathf_path;#definef_dentryf_path.dentry#definef_vfsmntf_path.mntconststructfile_operations*f_op;spinlock_tf_lo 阅读全文
posted @ 2013-04-09 10:28 puckpuck 阅读(437) 评论(0) 推荐(0) 编辑