fluke-dmm.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * This file is part of the libsigrok project.
  3. *
  4. * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef LIBSIGROK_HARDWARE_FLUKE_DMM_FLUKE_DMM_H
  20. #define LIBSIGROK_HARDWARE_FLUKE_DMM_FLUKE_DMM_H
  21. #define LOG_PREFIX "fluke-dmm"
  22. #define FLUKEDMM_BUFSIZE 256
  23. /* Supported models */
  24. enum {
  25. FLUKE_187 = 1,
  26. FLUKE_189,
  27. FLUKE_287,
  28. FLUKE_190,
  29. };
  30. /* Supported device profiles */
  31. struct flukedmm_profile {
  32. int model;
  33. const char *modelname;
  34. /* How often to poll, in ms. */
  35. int poll_period;
  36. /* If no response received, how long to wait before retrying. */
  37. int timeout;
  38. };
  39. /* Private, per-device-instance driver context. */
  40. struct dev_context {
  41. const struct flukedmm_profile *profile;
  42. uint64_t limit_samples;
  43. uint64_t limit_msec;
  44. /* Opaque pointer passed in by the frontend. */
  45. void *cb_data;
  46. /* Runtime. */
  47. uint64_t num_samples;
  48. char buf[FLUKEDMM_BUFSIZE];
  49. int buflen;
  50. int64_t cmd_sent_at;
  51. int expect_response;
  52. int meas_type;
  53. int is_relative;
  54. int mq;
  55. int unit;
  56. int mqflags;
  57. };
  58. SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data);
  59. #endif