fsm_rfic_ftr.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
  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. #ifndef _FSM_RFIC_FTR_H_
  13. #define _FSM_RFIC_FTR_H_
  14. #include <linux/ioctl.h>
  15. /*
  16. * Device interface
  17. */
  18. #define RFIC_FTR_DEVICE_NAME "rfic_ftr"
  19. /*
  20. * IOCTL interface
  21. */
  22. /*
  23. Macro to associate the "bus" and "address" pair when accessing the RFIC.
  24. Using a 32 bit address, reserve the upper 8 bits for the bus value, and
  25. the lower 24 bits for the address.
  26. */
  27. #define RFIC_FTR_ADDR(bus, addr) (((bus&0x03)<<24)|(addr&0xFFFFFF))
  28. #define RFIC_FTR_GET_ADDR(busAddr) (busAddr&0xFFFFFF)
  29. #define RFIC_FTR_GET_BUS(busAddr) ((busAddr>>24)&0x03)
  30. struct rfic_write_register_param {
  31. unsigned int rficAddr;
  32. unsigned int value;
  33. };
  34. struct rfic_write_register_mask_param {
  35. unsigned int rficAddr;
  36. unsigned int value;
  37. unsigned int mask;
  38. };
  39. struct rfic_grfc_param {
  40. unsigned int grfcId;
  41. unsigned int maskValue;
  42. unsigned int ctrlValue;
  43. };
  44. #define RFIC_IOCTL_MAGIC 'f'
  45. #define RFIC_IOCTL_READ_REGISTER \
  46. _IOC(_IOC_READ, RFIC_IOCTL_MAGIC, 0x01, \
  47. sizeof(unsigned int *))
  48. #define RFIC_IOCTL_WRITE_REGISTER \
  49. _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x02, \
  50. sizeof(struct rfic_write_register_param *))
  51. #define RFIC_IOCTL_WRITE_REGISTER_WITH_MASK \
  52. _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x03, \
  53. sizeof(struct rfic_write_register_mask_param *))
  54. #define RFIC_IOCTL_GET_GRFC \
  55. _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x10, \
  56. sizeof(struct rfic_grfc_param *))
  57. #define RFIC_IOCTL_SET_GRFC \
  58. _IOC(_IOC_WRITE, RFIC_IOCTL_MAGIC, 0x11, \
  59. sizeof(struct rfic_grfc_param *))
  60. #endif /* _FSM_RFIC_FTR_H_ */