/libsensors/taos_common.h

http://github.com/CyanogenMod/android_device_zte_blade · C Header · 61 lines · 40 code · 3 blank · 18 comment · 0 complexity · 57b1b58b22d6d68f38bb3b8e91c5a6fe MD5 · raw file

  1. /*******************************************************************************
  2. * *
  3. * File Name: taos_common.h *
  4. * Description: Common file for ioctl and configuration definitions. *
  5. * Used by kernel driver and driver access applications. *
  6. * Please include this file, and <sys/ioctl.h> in your *
  7. * driver access application program source. *
  8. * Author: John Koshi *
  9. * History: 09/16/2009 - Initial creation *
  10. * 02/07/2010 - Add proximity *
  11. * *
  12. ********************************************************************************
  13. * Proprietary to Taos Inc., 1001 Klein Road #300, Plano, TX 75074 *
  14. *******************************************************************************/
  15. // ioctl numbers
  16. #define TAOS_IOCTL_MAGIC 0XCF
  17. #define TAOS_IOCTL_ALS_ON _IO(TAOS_IOCTL_MAGIC, 1)
  18. #define TAOS_IOCTL_ALS_OFF _IO(TAOS_IOCTL_MAGIC, 2)
  19. #define TAOS_IOCTL_ALS_DATA _IOR(TAOS_IOCTL_MAGIC, 3, short)
  20. #define TAOS_IOCTL_ALS_CALIBRATE _IO(TAOS_IOCTL_MAGIC, 4)
  21. #define TAOS_IOCTL_CONFIG_GET _IOR(TAOS_IOCTL_MAGIC, 5, struct taos_cfg)
  22. #define TAOS_IOCTL_CONFIG_SET _IOW(TAOS_IOCTL_MAGIC, 6, struct taos_cfg)
  23. #define TAOS_IOCTL_PROX_ON _IO(TAOS_IOCTL_MAGIC, 7)
  24. #define TAOS_IOCTL_PROX_OFF _IO(TAOS_IOCTL_MAGIC, 8)
  25. #define TAOS_IOCTL_PROX_DATA _IOR(TAOS_IOCTL_MAGIC, 9, struct taos_prox_info)
  26. #define TAOS_IOCTL_PROX_EVENT _IO(TAOS_IOCTL_MAGIC, 10)
  27. #define TAOS_IOCTL_PROX_CALIBRATE _IO(TAOS_IOCTL_MAGIC, 11)
  28. #define TAOS_IOCTL_PROX_GET_ENABLED _IOR(TAOS_IOCTL_MAGIC, 12, int*)
  29. #define TAOS_IOCTL_ALS_GET_ENABLED _IOR(TAOS_IOCTL_MAGIC, 13, int*)
  30. //
  31. #define u32 unsigned int
  32. #define u16 unsigned short
  33. #define u8 unsigned char
  34. // device configuration
  35. struct taos_cfg {
  36. u32 calibrate_target;
  37. u16 als_time;
  38. u16 scale_factor;
  39. u16 gain_trim;
  40. u8 filter_history;
  41. u8 filter_count;
  42. u8 gain;
  43. u16 prox_threshold_hi;
  44. u16 prox_threshold_lo;
  45. u8 prox_int_time;
  46. u8 prox_adc_time;
  47. u8 prox_wait_time;
  48. u8 prox_intr_filter;
  49. u8 prox_config;
  50. u8 prox_pulse_cnt;
  51. u8 prox_gain;
  52. };
  53. // proximity data
  54. struct taos_prox_info {
  55. u16 prox_clear;
  56. u16 prox_data;
  57. int prox_event;
  58. };