comm.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef COMM_H
  2. #define COMM_H
  3. enum dat_st_t{
  4. DACST_STARTED = 0,
  5. DACST_FINISHED,
  6. };
  7. struct dac_t{
  8. int state;
  9. int stp;
  10. int timer;
  11. int timeout;
  12. int updated;
  13. int param_en;
  14. double totalcnt;
  15. double totaltime;
  16. double timing_ave;
  17. double timing_max;
  18. double timing_cur;
  19. double timing_start;
  20. double timing_end;
  21. };
  22. enum commst_t{
  23. COMMST_NORMAL = 0,
  24. COMMST_ERR,
  25. };
  26. struct comm_t{
  27. int chanidx;
  28. int adr;
  29. int state;
  30. char szState[32];
  31. struct dac_t dac;
  32. };
  33. void comm_reset(struct comm_t* comm);
  34. void comm_set_state(struct comm_t* comm, int state);
  35. int comm_get_state( struct comm_t* comm );
  36. void comm_set_dac_param_en(struct comm_t* comm, int val);
  37. int comm_get_dac_param_en(struct comm_t* comm);
  38. void comm_start_cal_dac_timing(struct comm_t* comm);
  39. void comm_stop_cal_dac_timing(struct comm_t* comm);
  40. void comm_get_summary(struct comm_t* comm, char* buf, int len);
  41. int comm_get_adr(struct comm_t* comm);
  42. int comm_get_chan_idx(struct comm_t* comm);
  43. char* comm_get_state_str(struct comm_t* comm);
  44. #endif /* COMM_H */