master/device.c
changeset 986 a486591ba86b
parent 759 fe32d4cdc9c3
child 1011 a0759d0dded4
equal deleted inserted replaced
985:90bcaf9ce3d5 986:a486591ba86b
   349     // calculate index of the newest frame in the ring to get its time
   349     // calculate index of the newest frame in the ring to get its time
   350     ring_index = (device->debug_frame_index + EC_DEBUG_RING_SIZE - 1)
   350     ring_index = (device->debug_frame_index + EC_DEBUG_RING_SIZE - 1)
   351         % EC_DEBUG_RING_SIZE;
   351         % EC_DEBUG_RING_SIZE;
   352     t0 = device->debug_frames[ring_index].t;
   352     t0 = device->debug_frames[ring_index].t;
   353 
   353 
   354     EC_DBG("Debug ring %i:\n", ring_index);
   354     EC_DBG("Debug ring %u:\n", ring_index);
   355 
   355 
   356     // calculate index of the oldest frame in the ring
   356     // calculate index of the oldest frame in the ring
   357     ring_index = (device->debug_frame_index + EC_DEBUG_RING_SIZE
   357     ring_index = (device->debug_frame_index + EC_DEBUG_RING_SIZE
   358             - device->debug_frame_count) % EC_DEBUG_RING_SIZE;
   358             - device->debug_frame_count) % EC_DEBUG_RING_SIZE;
   359 
   359 
   360     for (i = 0; i < device->debug_frame_count; i++) {
   360     for (i = 0; i < device->debug_frame_count; i++) {
   361         df = &device->debug_frames[ring_index];
   361         df = &device->debug_frames[ring_index];
   362         timersub(&t0, &df->t, &diff);
   362         timersub(&t0, &df->t, &diff);
   363 
   363 
   364         EC_DBG("Frame %i, dt=%u.%06u s, %s:\n",
   364         EC_DBG("Frame %u, dt=%u.%06u s, %s:\n",
   365                 i + 1 - device->debug_frame_count,
   365                 i + 1 - device->debug_frame_count,
   366                 (unsigned int) diff.tv_sec,
   366                 (unsigned int) diff.tv_sec,
   367                 (unsigned int) diff.tv_usec,
   367                 (unsigned int) diff.tv_usec,
   368                 (df->dir == TX) ? "TX" : "RX");
   368                 (df->dir == TX) ? "TX" : "RX");
   369         ec_print_data(df->data, df->data_size);
   369         ec_print_data(df->data, df->data_size);