266 std::stringstream ss;
277 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Unable to get handle to device; giving up!" << std::endl;
286 unsigned int pdts_status = 0;
287 unsigned int pdts_control = 0;
288 unsigned int dsp_clock_control = 0;
290 fDevice->DeviceRead(duneReg.
pdts_status, &pdts_status);
292 fDevice->DeviceRead(duneReg.
pdts_control, &pdts_control);
298 unsigned int presentTimingAddress = (pdts_control >> 16) & 0xFF;
299 unsigned int presentTimingPartition = pdts_control & 0x3;
301 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"SSP HW presently on partition " << presentTimingPartition <<
", address 0x" << std::hex
302 << presentTimingAddress <<
" with endpoint status 0x" << (pdts_status & 0xF)
303 <<
" and dsp_clock_control at 0x" << dsp_clock_control << std::dec << std::endl;
307 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8 && presentTimingAddress == fTimingAddress &&
308 presentTimingPartition == fPartitionNumber && (dsp_clock_control & 0xF) == 0x1) {
311 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Clock already looks ok... skipping endpoint reset." << std::endl;
314 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Syncing SSP LED Calib to PDTS (partition " << fPartitionNumber <<
", endpoint address 0x"
315 << std::hex << fTimingAddress << std::dec <<
")" << std::endl;
317 unsigned int nTries = 0;
323 fDevice->DeviceWrite(duneReg.
pdts_control, 0x80000000 + fPartitionNumber + fTimingAddress * 0x10000);
325 <<
"The pdts_control value was set to 0x" << std::hex << 0x80000000 + fPartitionNumber + fTimingAddress * 0x10000
326 << std::dec << std::endl;
328 fDevice->DeviceRead(duneReg.
pdts_status, &pdts_status);
331 fDevice->DeviceRead(duneReg.
pdts_control, &pdts_control);
338 fDevice->DeviceWrite(duneReg.
pdts_control, 0x00000000 + fPartitionNumber + fTimingAddress * 0x10000);
340 << 0x00000000 + fPartitionNumber + fTimingAddress * 0x10000 << std::dec << std::endl;
346 fDevice->DeviceRead(duneReg.
pdts_status, &pdts_status);
349 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8)
351 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Timing endpoint sync failed (try " << nTries <<
")" << std::endl;
355 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8) {
357 <<
" and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec
359 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Timing endpoint synced!" << std::endl;
362 <<
" and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec
364 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Giving up on endpoint sync after 5 tries. Value of pdts_status register was 0x"
365 << std::hex << pdts_status << std::dec << std::endl;
369 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Woke up from 2 seconds of sleep and Waiting for endpoint to reach status 0x8..."
372 if ((pdts_status & 0xF) != 0x8) {
373 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Waiting for endpoint to reach status 0x8..." << std::endl;
375 <<
" and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec << std::endl;
378 while ((pdts_status & 0xF) != 0x8) {
380 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Wrong PDTS status!" << std::endl;
385 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Woke up from 2 seconds of sleep and Waiting for endpoint to reach status 0x8..."
387 fDevice->DeviceRead(duneReg.
pdts_status, &pdts_status);
389 <<
" and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec << std::endl;
393 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Endpoint is in running state, continuing with configuration!" << std::endl;