Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, The Linux Foundation. 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_RFIC_FTR_H_ |
| 14 | #define _FSM_RFIC_FTR_H_ |
| 15 | |
| 16 | #include <linux/ioctl.h> |
| 17 | |
| 18 | /* |
| 19 | * Device interface |
| 20 | */ |
| 21 | |
| 22 | #define RFIC_FTR_DEVICE_NAME "rfic_ftr" |
| 23 | |
| 24 | /* |
| 25 | * IOCTL interface |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | Macro to associate the "bus" and "address" pair when accessing the RFIC. |
| 30 | Using a 32 bit address, reserve the upper 8 bits for the bus value, and |
| 31 | the lower 24 bits for the address. |
| 32 | */ |
| 33 | #define RFIC_FTR_ADDR(bus, addr) (((bus&0x03)<<24)|(addr&0xFFFFFF)) |
| 34 | #define RFIC_FTR_GET_ADDR(busAddr) (busAddr&0xFFFFFF) |
| 35 | #define RFIC_FTR_GET_BUS(busAddr) ((busAddr>>24)&0x03) |
| 36 | |
| 37 | struct rfic_write_register_param { |
| 38 | unsigned int rficAddr; |
| 39 | unsigned int value; |
| 40 | }; |
| 41 | |
| 42 | struct rfic_write_register_mask_param { |
| 43 | unsigned int rficAddr; |
| 44 | unsigned int value; |
| 45 | unsigned int mask; |
| 46 | }; |
| 47 | |
| 48 | struct rfic_grfc_param { |
| 49 | unsigned int grfcId; |
| 50 | unsigned int maskValue; |
| 51 | unsigned int ctrlValue; |
| 52 | }; |
| 53 | |
| 54 | #define RFIC_IOCTL_MAGIC 'f' |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 55 | #define RFIC_IOCTL_READ_REGISTER \ |
| 56 | _IOC(_IOC_READ, RFIC_IOCTL_MAGIC, 0x01, \ |
| 57 | sizeof(unsigned int *)) |
| 58 | #define RFIC_IOCTL_WRITE_REGISTER \ |
| 59 | _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x02, \ |
| 60 | sizeof(struct rfic_write_register_param *)) |
| 61 | #define RFIC_IOCTL_WRITE_REGISTER_WITH_MASK \ |
| 62 | _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x03, \ |
| 63 | sizeof(struct rfic_write_register_mask_param *)) |
| 64 | #define RFIC_IOCTL_GET_GRFC \ |
| 65 | _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x10, \ |
| 66 | sizeof(struct rfic_grfc_param *)) |
| 67 | #define RFIC_IOCTL_SET_GRFC \ |
| 68 | _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x11, \ |
| 69 | sizeof(struct rfic_grfc_param *)) |
| 70 | |
| 71 | #endif /* _FSM_RFIC_FTR_H_ */ |