27 printf(
"Using PDTS for DUNE timing.\n\nConfiguring clock and data separator\n");
34 e.
Append(
"Failed to communicate with the DTS CDS via I2C\n");
37 uint32_t LOL =
Read(
"DTS.CDS.LOL");
38 uint32_t LOS =
Read(
"DTS.CDS.LOS");
39 printf(
"CDS frequency %f\n",frequency);
40 printf(
"CDS LOL=%d LOS=%d\n",LOL,LOS);
45 BUException::WIB_DTS_ERROR e;
46 e.
Append(
"Failed to configure CDS chip\n");
50 printf(
"Using local OSC for DUNE timing\n");
55 printf(
"\nConfiguring SI5344.\n");
69 e.
Append(
"Error in LoadConfigDTS_SI5344\n");
84 BUException::WIB_DTS_ERROR e;
85 e.
Append(
"Failed to configure the SI5344 chip correctly\n");
93 char const *
const PDTSStates[] = {
"W_RST",
111 if(0 == clockSource){
112 printf(
"\nSetup PDTS.\n");
113 bool timeout_exists =
true;
114 if (PDTSAlignment_timeout == 0)
115 timeout_exists =
false;
117 auto start_time = std::chrono::high_resolution_clock::now();
118 bool timed_out =
false;
120 while ((timeout_exists ==
false) || timed_out ==
false) {
128 printf(
"PDTS state: %s (0x%01X)\n",PDTSStates[pdts_state&0xF],pdts_state);
129 if ((pdts_state < 0x6) || (pdts_state > 0x8)) {
132 Write(
"DTS.SI5344.I2C.RESET",1);
134 Write(
"DTS.SI5344.I2C.RESET",1);
137 else if(0x6 == pdts_state){
140 else if(0x7 == pdts_state){
146 auto now = std::chrono::high_resolution_clock::now();
147 auto duration =
now - start_time;
148 if ( duration.count() > PDTSAlignment_timeout)
152 Write(
"DTS.SI5344.I2C.RESET",1);
154 Write(
"DTS.SI5344.I2C.RESET",1);
157 BUException::WIB_DTS_ERROR e;
158 e.
Append(
"Failed to configure the PDTS correctly within timeout\n");