Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_driver.c

    r5f97ef44 r205f1add  
    384384 *  @return Current polling mode of the controller
    385385 */
    386 nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timeval *period)
     386nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timespec *period)
    387387{
    388388        if (period)
     
    400400 */
    401401errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
    402     struct timeval *period)
     402    struct timespec *period)
    403403{
    404404        errno_t rc = EOK;
     
    408408        if (mode == NIC_POLL_PERIODIC) {
    409409                if (period) {
    410                         memcpy(&nic_data->default_poll_period, period, sizeof(struct timeval));
    411                         memcpy(&nic_data->poll_period, period, sizeof(struct timeval));
     410                        memcpy(&nic_data->default_poll_period, period, sizeof(struct timespec));
     411                        memcpy(&nic_data->poll_period, period, sizeof(struct timespec));
    412412                } else {
    413413                        rc = EINVAL;
     
    10301030 *  @returns Nonzero if t is zero interval
    10311031 */
    1032 static int timeval_nonpositive(struct timeval t)
    1033 {
    1034         return (t.tv_sec <= 0) && (t.tv_usec <= 0);
     1032static int timespec_nonpositive(struct timespec t)
     1033{
     1034        return (t.tv_sec <= 0) && (t.tv_nsec <= 0);
    10351035}
    10361036
     
    10511051                int run = info->run;
    10521052                int running = info->running;
    1053                 struct timeval remaining = nic->poll_period;
     1053                struct timespec remaining = nic->poll_period;
    10541054                fibril_rwlock_read_unlock(&nic->main_lock);
    10551055
    10561056                if (!running) {
    10571057                        remaining.tv_sec = 5;
    1058                         remaining.tv_usec = 0;
     1058                        remaining.tv_nsec = 0;
    10591059                }
    10601060
    10611061                /* Wait the period (keep attention to overflows) */
    1062                 while (!timeval_nonpositive(remaining)) {
    1063                         suseconds_t wait = 0;
     1062                while (!timespec_nonpositive(remaining)) {
     1063                        usec_t wait = 0;
    10641064                        if (remaining.tv_sec > 0) {
    10651065                                time_t wait_sec = remaining.tv_sec;
     
    10711071                                        wait_sec = 5;
    10721072
    1073                                 wait = (suseconds_t) wait_sec * 1000000;
     1073                                wait = SEC2USEC(wait_sec);
    10741074
    10751075                                remaining.tv_sec -= wait_sec;
    10761076                        } else {
    1077                                 wait = remaining.tv_usec;
     1077                                wait = NSEC2USEC(remaining.tv_nsec);
    10781078
    10791079                                if (wait > 5 * 1000000) {
     
    10811081                                }
    10821082
    1083                                 remaining.tv_usec -= wait;
     1083                                remaining.tv_nsec -= USEC2NSEC(wait);
    10841084                        }
    10851085                        fibril_usleep(wait);
Note: See TracChangeset for help on using the changeset viewer.