readout software for 2 channels [0 and 1] of the tdc-gpx2 board with raspberry pi 3B SPI readout. This code is a fork of the original design by marvin.peter@physik.uni-giessen.de https://github.com/marvin5300/tdc-gpx2_software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB

1 year ago
  1. #ifndef CONFIG_H
  2. #define CONFIG_H
  3. #include <stdint.h>
  4. #include <string>
  5. namespace SPI {
  6. namespace GPX2_TDC {
  7. struct Config {
  8. // reg_addr 0
  9. uint8_t PIN_ENA_RSTIDX : 1;
  10. uint8_t PIN_ENA_DISABLE : 1;
  11. uint8_t PIN_ENA_LVDS_OUT : 1;
  12. uint8_t PIN_ENA_REFCLK : 1;
  13. uint8_t PIN_ENA_STOP4 : 1;
  14. uint8_t PIN_ENA_STOP3 : 1;
  15. uint8_t PIN_ENA_STOP2 : 1;
  16. uint8_t PIN_ENA_STOP1 : 1;
  17. // reg_addr 1
  18. uint8_t HIGH_RESOLUTION : 2;
  19. uint8_t CHANNEL_COMBINE : 2;
  20. uint8_t HIT_ENA_STOP4 : 1;
  21. uint8_t HIT_ENA_STOP3 : 1;
  22. uint8_t HIT_ENA_STOP2 : 1;
  23. uint8_t HIT_ENA_STOP1 : 1;
  24. // reg_addr 2
  25. uint8_t BLOCKWISE_FIFO_READ : 1;
  26. uint8_t COMMON_FIFO_READ : 1;
  27. uint8_t LVS_DOUBLE_DATA_RATE : 1;
  28. uint8_t STOP_DATA_BITWIDTH : 2;
  29. uint8_t REF_INDEX_BITWIDTH : 3;
  30. // reg_addr 3
  31. uint8_t REFCLK_DIVISIONS_LOWER; // (Lower byte)
  32. // reg_addr 4
  33. uint8_t REFCLK_DIVISIONS_MIDDLE; // (Middle byte)
  34. // reg_addr 5
  35. uint8_t REFCLK_DIVISIONS_UPPER : 4; // (Upper bits)
  36. // reg_addr 6
  37. uint8_t LVDS_TEST_PATTERN : 1;
  38. // reg_addr 7
  39. uint8_t REFCLK_BY_XOSC : 1;
  40. uint8_t LVDS_DATA_VALID_ADJUST : 2;
  41. // reg_addr 16
  42. uint8_t CMOS_INPUT : 1;
  43. Config();
  44. void loadDefaultConfig();
  45. double refclk_freq{5e6};
  46. uint32_t refclk_divisions();
  47. std::string str() const;
  48. };
  49. }
  50. }
  51. #endif // !CONFIG_H