Changeset bd41ac52 in mainline for uspace/drv/bus/usb
- Timestamp:
- 2018-08-25T22:21:25Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cca80a2
- Parents:
- e2625b1a
- Location:
- uspace/drv/bus/usb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci_rh.c
re2625b1a rbd41ac52 34 34 #include <macros.h> 35 35 #include <mem.h> 36 #include < sys/time.h>36 #include <time.h> 37 37 38 38 #include <usb/debug.h> -
uspace/drv/bus/usb/usbdiag/tests.c
re2625b1a rbd41ac52 72 72 uint32_t transfer_count = 0; 73 73 74 struct time valstart_time, final_time, stop_time;75 get timeofday(&start_time, NULL);76 get timeofday(&stop_time, NULL);77 78 t v_add_diff(&stop_time, params->min_duration * 1000);79 get timeofday(&final_time, NULL);80 81 while (!t v_gt(&final_time, &stop_time)) {74 struct timespec start_time, final_time, stop_time; 75 getuptime(&start_time); 76 getuptime(&stop_time); 77 78 ts_add_diff(&stop_time, MSEC2NSEC(params->min_duration)); 79 getuptime(&final_time); 80 81 while (!ts_gt(&final_time, &stop_time)) { 82 82 ++transfer_count; 83 83 … … 121 121 } 122 122 123 get timeofday(&final_time, NULL);124 } 125 126 usbdiag_dur_t in_duration = ((final_time.tv_usec - start_time.tv_usec) / 1000) +127 ((final_time.tv_sec - start_time.tv_sec) * 1000);123 getuptime(&final_time); 124 } 125 126 usbdiag_dur_t in_duration = NSEC2MSEC(final_time.tv_nsec - start_time.tv_nsec) + 127 SEC2MSEC(final_time.tv_sec - start_time.tv_sec); 128 128 129 129 usb_log_info("Test on %s IN endpoint completed in %lu ms.", usb_str_transfer_type(pipe->desc.transfer_type), in_duration); … … 170 170 uint32_t transfer_count = 0; 171 171 172 struct time valstart_time, final_time, stop_time;173 get timeofday(&start_time, NULL);174 get timeofday(&stop_time, NULL);175 176 t v_add_diff(&stop_time, params->min_duration * 1000);177 get timeofday(&final_time, NULL);178 179 while (!t v_gt(&final_time, &stop_time)) {172 struct timespec start_time, final_time, stop_time; 173 getuptime(&start_time); 174 getuptime(&stop_time); 175 176 ts_add_diff(&stop_time, MSEC2NSEC(params->min_duration)); 177 getuptime(&final_time); 178 179 while (!ts_gt(&final_time, &stop_time)) { 180 180 ++transfer_count; 181 181 … … 186 186 } 187 187 188 get timeofday(&final_time, NULL);189 } 190 191 usbdiag_dur_t in_duration = ((final_time.tv_usec - start_time.tv_usec) / 1000) +192 ((final_time.tv_sec - start_time.tv_sec) * 1000);188 getuptime(&final_time); 189 } 190 191 usbdiag_dur_t in_duration = NSEC2MSEC(final_time.tv_nsec - start_time.tv_nsec) + 192 SEC2MSEC(final_time.tv_sec - start_time.tv_sec); 193 193 194 194 usb_log_info("Test on %s OUT endpoint completed in %ld ms.", usb_str_transfer_type(pipe->desc.transfer_type), in_duration); -
uspace/drv/bus/usb/vhc/hub/hub.c
re2625b1a rbd41ac52 64 64 static void clear_port_status_change(hub_port_t *, uint16_t); 65 65 static errno_t set_port_state_delayed_fibril(void *); 66 static void set_port_state_delayed(hub_t *, size_t, suseconds_t,67 hub_port_state_t , hub_port_state_t);66 static void set_port_state_delayed(hub_t *, size_t, usec_t, hub_port_state_t, 67 hub_port_state_t); 68 68 69 69 /** Convert hub port state to a char. */ … … 444 444 struct delay_port_state_change { 445 445 /** Delay in microseconds. */ 446 suseconds_t delay;446 usec_t delay; 447 447 /** Old state of the port. */ 448 448 hub_port_state_t old_state; … … 496 496 */ 497 497 static void set_port_state_delayed(hub_t *hub, size_t port_index, 498 suseconds_t delay_time_ms,499 hub_port_state_t old_state, hub_port_state_tnew_state)498 usec_t delay_time_ms, hub_port_state_t old_state, 499 hub_port_state_t new_state) 500 500 { 501 501 struct delay_port_state_change *change = … … 504 504 change->hub = hub; 505 505 change->port = port_index; 506 change->delay = delay_time_ms * 1000;506 change->delay = MSEC2USEC(delay_time_ms); 507 507 change->old_state = old_state; 508 508 change->new_state = new_state; -
uspace/drv/bus/usb/xhci/hc.c
re2625b1a rbd41ac52 229 229 hc->max_slots = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_SLOTS); 230 230 231 struct time val tv;232 getuptime(&t v);233 hc->wrap_time = tv.tv_sec * 1000000 + tv.tv_usec;231 struct timespec ts; 232 getuptime(&ts); 233 hc->wrap_time = SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec); 234 234 hc->wrap_count = 0; 235 235 … … 591 591 static errno_t xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb) 592 592 { 593 struct time val tv;594 getuptime(&t v);595 usb_log_debug("Microframe index wrapped (@%l u.%li, %" PRIu64 " total).",596 t v.tv_sec, tv.tv_usec, hc->wrap_count);597 hc->wrap_time = ((uint64_t) tv.tv_sec) * 1000000 + ((uint64_t) tv.tv_usec);593 struct timespec ts; 594 getuptime(&ts); 595 usb_log_debug("Microframe index wrapped (@%lld.%lld, %" PRIu64 " total).", 596 ts.tv_sec, NSEC2USEC(ts.tv_nsec), hc->wrap_count); 597 hc->wrap_time = SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec); 598 598 ++hc->wrap_count; 599 599 return EOK; -
uspace/drv/bus/usb/xhci/isoch.c
re2625b1a rbd41ac52 113 113 { 114 114 xhci_isoch_t *const isoch = ep->isoch; 115 const suseconds_t delay = isoch->buffer_count * ep->interval * 125 +115 const usec_t delay = isoch->buffer_count * ep->interval * 125 + 116 116 RESET_TIMER_DELAY; 117 117 … … 210 210 static inline uint64_t get_system_time() 211 211 { 212 struct time val tv;213 getuptime(&t v);214 return ((uint64_t) tv.tv_sec) * 1000000 + ((uint64_t) tv.tv_usec);212 struct timespec ts; 213 getuptime(&ts); 214 return SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec); 215 215 } 216 216 … … 314 314 while (isoch->transfers[isoch->hw_enqueue].state == ISOCH_FILLED) { 315 315 xhci_isoch_transfer_t *const it = &isoch->transfers[isoch->hw_enqueue]; 316 suseconds_t delay;316 usec_t delay; 317 317 318 318 assert(it->state == ISOCH_FILLED); … … 324 324 case WINDOW_TOO_SOON: 325 325 delay = wd.offset * 125; 326 usb_log_debug("[isoch] delaying feeding buffer %zu for %l dus",326 usb_log_debug("[isoch] delaying feeding buffer %zu for %lldus", 327 327 it - isoch->transfers, delay); 328 328 fibril_timer_set_locked(isoch->feeding_timer, delay, … … 400 400 while (isoch->transfers[isoch->enqueue].state <= ISOCH_FILLED) { 401 401 xhci_isoch_transfer_t *const it = &isoch->transfers[isoch->enqueue]; 402 suseconds_t delay;402 usec_t delay; 403 403 404 404 /* IN buffers are "filled" with free space */ … … 416 416 /* Not allowed to feed yet. Defer to later. */ 417 417 delay = wd.offset * 125; 418 usb_log_debug("[isoch] delaying feeding buffer %zu for %l dus",418 usb_log_debug("[isoch] delaying feeding buffer %zu for %lldus", 419 419 it - isoch->transfers, delay); 420 420 fibril_timer_set_locked(isoch->feeding_timer, delay,
Note:
See TracChangeset
for help on using the changeset viewer.