em_base); 34. } 35. 36. return 0; 37.} 38. 39.static int device_release(struct inode *inode, struct file *file) 40.{ 41. return 0; 42.} 43. 44. 45.static ssize_t device_read(struct file *filp, char *buffer, size_t length, loff_t *offset) 46.{ 47. /*int ret_val = 0; 48. 49. char * data = NULL; 论文网 50. 51. data = (char*)kmalloc(4, GFP_KERNEL); 52. if((ret_val = copy_from_user(new_regs, (struct reg_data*)ioctl_param, sizeof(struct reg_data))) != 0) 53. 54. ioread32(g_mkg_mem_base+length); 55. printk("============read:%d\n",);*/ 56. 57. return 1; 58.} 59. 60.static ssize_t device_write(struct file *filp, const char *buffer, size_t count, loff_t *offset) 61.{ 62. //iowrite32(2,g_mkg_mem_base); 63. return 1; 64.} 65. 66.long device_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioctl_param) 67.{ 68.#if 0 69. 70. int ret_val = 0; 71. unsigned int ret = 0; 72. struct reg_data *new_regs; 73. printk("ioctl======\n"); 74. 75. switch(ioctl_num) 76. { 77. case IOCTL_REG_SET: 78. { 79. new_regs = (struct reg_data*)kmalloc(sizeof(struct reg_data), GFP_KERNEL); 80. if((ret_val = copy_from_user(new_regs, (struct reg_data*)ioctl_param, sizeof(struct reg_data))) != 0) 81. { 82. kfree(new_regs); 83. printk(KERN_ERR " error copy line_datafrom user.\n"); 84. return -1; 85. } 86. 87. //iowrite16(new_regs->value,g_mkg_mem_base+new_regs->addr); 88. k上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
|