Rohit Vaswani | b766bef | 2012-01-11 14:52:26 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _FSM_DFE_HH_H_ |
| 14 | #define _FSM_DFE_HH_H_ |
| 15 | |
| 16 | #include <linux/ioctl.h> |
| 17 | |
| 18 | /* |
| 19 | * Device interface |
| 20 | */ |
| 21 | |
| 22 | #define DFE_HH_DEVICE_NAME "dfe_hh" |
| 23 | |
| 24 | /* |
| 25 | * IOCTL interface |
| 26 | */ |
| 27 | |
| 28 | enum { |
| 29 | DFE_IOCTL_COMMAND_CODE_WRITE, |
| 30 | DFE_IOCTL_COMMAND_CODE_WRITE_WITH_MASK, |
| 31 | }; |
| 32 | |
| 33 | struct dfe_write_register_param { |
| 34 | unsigned int offset; |
| 35 | unsigned int value; |
| 36 | }; |
| 37 | |
| 38 | struct dfe_write_register_mask_param { |
| 39 | unsigned int offset; |
| 40 | unsigned int value; |
| 41 | unsigned int mask; |
| 42 | }; |
| 43 | |
| 44 | struct dfe_read_write_array_param { |
| 45 | unsigned int offset; |
| 46 | unsigned int num; /* number of 16 bit registers */ |
| 47 | unsigned int *pArray; |
| 48 | }; |
| 49 | |
| 50 | struct dfe_command_entry { |
| 51 | unsigned int code; |
| 52 | unsigned int offset; |
| 53 | unsigned int value; |
| 54 | unsigned int mask; /* DFE_IOCTL_COMMAND_CODE_WRITE_WITH_MASK only */ |
| 55 | }; |
| 56 | |
| 57 | struct dfe_command_param { |
| 58 | unsigned int num; |
| 59 | struct dfe_command_entry *pEntry; |
| 60 | }; |
| 61 | |
| 62 | #define DFE_IOCTL_MAGIC 'h' |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 63 | #define DFE_IOCTL_READ_REGISTER \ |
| 64 | _IOC(_IOC_READ, DFE_IOCTL_MAGIC, 0x01, \ |
| 65 | sizeof(unsigned int *)) |
| 66 | #define DFE_IOCTL_WRITE_REGISTER \ |
| 67 | _IOC(_IOC_WRITE, DFE_IOCTL_MAGIC, 0x02, \ |
| 68 | sizeof(struct dfe_write_register_param *)) |
| 69 | #define DFE_IOCTL_WRITE_REGISTER_WITH_MASK \ |
| 70 | _IOC(_IOC_WRITE, DFE_IOCTL_MAGIC, 0x03, \ |
| 71 | sizeof(struct dfe_write_register_mask_param *)) |
| 72 | #define DFE_IOCTL_READ_REGISTER_ARRAY \ |
| 73 | _IOC(_IOC_READ, DFE_IOCTL_MAGIC, 0x04, \ |
| 74 | sizeof(struct dfe_read_write_array_param *)) |
| 75 | #define DFE_IOCTL_WRITE_REGISTER_ARRAY \ |
| 76 | _IOC(_IOC_WRITE, DFE_IOCTL_MAGIC, 0x05, \ |
| 77 | sizeof(struct dfe_read_write_array_param *)) |
| 78 | #define DFE_IOCTL_COMMAND \ |
| 79 | _IOC(_IOC_WRITE, DFE_IOCTL_MAGIC, 0x10, \ |
| 80 | sizeof(struct dfe_command_param *)) |
| 81 | |
| 82 | #endif /* _FSM_DFE_HH_H_ */ |