262{
263
265
266 std::stringstream ss;
267 fDeviceId = inet_network(conf->get_board_ip().c_str());
268
269
272
273
275
276 if (!device) {
277 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Unable to get handle to device; giving up!" << std::endl;
278 throw(ENoSuchDevice());
279 }
280
282
283
285
286 unsigned int pdts_status = 0;
287 unsigned int pdts_control = 0;
288 unsigned int dsp_clock_control = 0;
289
296 << std::endl;
297
298 unsigned int presentTimingAddress = (pdts_control >> 16) & 0xFF;
299 unsigned int presentTimingPartition = pdts_control & 0x3;
300
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;
304
305
306
307 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8 && presentTimingAddress ==
fTimingAddress &&
308 presentTimingPartition ==
fPartitionNumber && (dsp_clock_control & 0xF) == 0x1) {
309
310
311 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Clock already looks ok... skipping endpoint reset." << std::endl;
312 } else {
313
316
317 unsigned int nTries = 0;
318
319 while (nTries < 5) {
322 << std::endl;
326 << std::dec << std::endl;
327
330 << std::endl;
333 << std::endl;
336 << std::endl;
337
341 usleep(2000000);
343 0x31);
345 usleep(2000000);
348 << std::endl;
349 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8)
350 break;
351 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Timing endpoint sync failed (try " << nTries <<
")" << std::endl;
352 ++nTries;
353 }
354
355 if ((pdts_status & 0xF) >= 0x6 && (pdts_status & 0xF) <= 0x8) {
357 << " and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec
358 << std::endl;
359 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Timing endpoint synced!" << std::endl;
360 } else {
362 << " and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec
363 << std::endl;
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;
366 }
367 }
368
369 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Woke up from 2 seconds of sleep and Waiting for endpoint to reach status 0x8..."
370 << std::endl;
371
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;
376 }
377 int nTries = 0;
378 while ((pdts_status & 0xF) != 0x8) {
379 if (nTries == 2) {
380 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Wrong PDTS status!" << std::endl;
381
383 }
384 usleep(2000000);
385 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Woke up from 2 seconds of sleep and Waiting for endpoint to reach status 0x8..."
386 << std::endl;
389 << " and the 0xF bit masked value is 0x" << (pdts_status & 0xF) << std::dec << std::endl;
390 nTries++;
391 }
392
393 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Endpoint is in running state, continuing with configuration!" << std::endl;
395}
Device * OpenDevice(unsigned int deviceId, bool slowControlOnly=false)
static DeviceManager & Get()
virtual void DeviceRead(unsigned int address, unsigned int *value)=0
virtual void DeviceWrite(unsigned int address, unsigned int value)=0
unsigned int dsp_clock_control
unsigned int pdts_control
#define TLVL_ENTER_EXIT_METHODS
#define TLOG_DEBUG(lvl,...)
LED calibration failed to ERS_EMPTY DeviceInterfacePDTSStatus