diff options
Diffstat (limited to '1/fopdrv.c')
-rw-r--r-- | 1/fopdrv.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,4 +1,7 @@ +#include <linux/io.h> + #include "fopdrv.h" +#include "config.h" // driver/char/mem.c read_null (/dev/null) ssize_t fop_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { @@ -6,7 +9,6 @@ ssize_t fop_read(struct file *file, char __user *buf, size_t count, loff_t *ppos return 0; } -// driver/char/mem.c write_null ssize_t fop_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { printk("%s(<file>, <buf>, %u, <ppos>)\n", __PRETTY_FUNCTION__, count); @@ -18,13 +20,20 @@ ssize_t fop_write(struct file *file, const char __user *buf, size_t count, loff_ if (copy_from_user(input_buf + *ppos, buf, count)) return -EFAULT; + ti_am335x_word_t* gpio1 = ioremap(TI_AM335X_GPIO1_ADDR, GPIO_REG_SIZE); + barrier(); + if (input_buf[0] == '0') { printk("TODO: TURN OFF OUTPUT\n"); + iowrite32((1<<PIN), gpio1 + GPIO_CLEARDATAOUT); wmb(); } if (input_buf[0] == '1') { printk("TODO: TURN ON OUTPUT\n"); + iowrite32((1<<PIN), gpio1 + GPIO_SETDATAOUT); wmb(); } + iounmap(gpio1); + return count; } |