/* * ioctl.c */ #include "hrt.h" #include "hrt_shared.h" int hrt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int r = 0, iarg = *((int*)arg); hrt_dev_t* dev = file->private_data; switch (cmd) { case IOC_HRT_SET_DRIVE_MODE: hrt_printk("IOC_HRT_SET_DRIVE_MODE: called with arg %d\n", iarg); hrt_remove_interrupt(dev); dev->use_interrupts = iarg; hrt_install_interrupt(dev); break; case IOC_HRT_FREEZE_FRAME: hrt_printk("IOC_HRT_FREEZE_FRAME: called\n"); hrt_dev_freeze_imm(dev); break; case IOC_HRT_GO_LIVE: hrt_printk("IOC_HRT_GO_LIVE: called\n"); hrt_dev_go_live(dev); break; case IOC_HRT_WIN_SET_WIDTH: hrt_printk("IOC_HRT_WIN_SET_WIDTH: called with arg %d\n", iarg); dev->width = iarg; break; case IOC_HRT_WIN_SET_HEIGHT: hrt_printk("IOC_HRT_WIN_SET_HEIGHT: called with arg %d\n", iarg); dev->height = iarg; break; case IOC_HRT_WIN_SET_X: hrt_printk("IOC_HRT_WIN_SET_X: called with arg %d\n", iarg); dev->x = iarg; break; case IOC_HRT_WIN_SET_Y: hrt_printk("IOC_HRT_WIN_SET_Y: called with arg %d\n", iarg); dev->y = iarg; break; case IOC_HRT_STOP_DRV_READ: hrt_printk("IOC_HRT_STOP_DRV_READ: called\n"); hrt_remove_interrupt(dev); break; case IOC_HRT_START_DRV_READ: hrt_printk("IOC_HRT_START_DRV_READ: called\n"); hrt_install_interrupt(dev); break; default: r = -1; break; } return r; }