Changeset 231b3fd in mainline for uspace/lib/nic/src/nic_driver.c
- Timestamp:
- 2018-08-25T21:35:26Z (6 years ago)
- Parents:
- e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
- git-committer:
- GitHub <noreply@…> (2018-08-25 21:35:26)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_driver.c
re2625b1a r231b3fd 384 384 * @return Current polling mode of the controller 385 385 */ 386 nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct time val*period)386 nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timespec *period) 387 387 { 388 388 if (period) … … 400 400 */ 401 401 errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode, 402 struct time val*period)402 struct timespec *period) 403 403 { 404 404 errno_t rc = EOK; … … 408 408 if (mode == NIC_POLL_PERIODIC) { 409 409 if (period) { 410 memcpy(&nic_data->default_poll_period, period, sizeof(struct time val));411 memcpy(&nic_data->poll_period, period, sizeof(struct time val));410 memcpy(&nic_data->default_poll_period, period, sizeof(struct timespec)); 411 memcpy(&nic_data->poll_period, period, sizeof(struct timespec)); 412 412 } else { 413 413 rc = EINVAL; … … 1030 1030 * @returns Nonzero if t is zero interval 1031 1031 */ 1032 static int time val_nonpositive(struct timevalt)1033 { 1034 return (t.tv_sec <= 0) && (t.tv_ usec <= 0);1032 static int timespec_nonpositive(struct timespec t) 1033 { 1034 return (t.tv_sec <= 0) && (t.tv_nsec <= 0); 1035 1035 } 1036 1036 … … 1051 1051 int run = info->run; 1052 1052 int running = info->running; 1053 struct time valremaining = nic->poll_period;1053 struct timespec remaining = nic->poll_period; 1054 1054 fibril_rwlock_read_unlock(&nic->main_lock); 1055 1055 1056 1056 if (!running) { 1057 1057 remaining.tv_sec = 5; 1058 remaining.tv_ usec = 0;1058 remaining.tv_nsec = 0; 1059 1059 } 1060 1060 1061 1061 /* Wait the period (keep attention to overflows) */ 1062 while (!time val_nonpositive(remaining)) {1063 suseconds_t wait = 0;1062 while (!timespec_nonpositive(remaining)) { 1063 usec_t wait = 0; 1064 1064 if (remaining.tv_sec > 0) { 1065 1065 time_t wait_sec = remaining.tv_sec; … … 1071 1071 wait_sec = 5; 1072 1072 1073 wait = (suseconds_t) wait_sec * 1000000;1073 wait = SEC2USEC(wait_sec); 1074 1074 1075 1075 remaining.tv_sec -= wait_sec; 1076 1076 } else { 1077 wait = remaining.tv_usec;1077 wait = NSEC2USEC(remaining.tv_nsec); 1078 1078 1079 1079 if (wait > 5 * 1000000) { … … 1081 1081 } 1082 1082 1083 remaining.tv_ usec -= wait;1083 remaining.tv_nsec -= USEC2NSEC(wait); 1084 1084 } 1085 1085 fibril_usleep(wait);
Note:
See TracChangeset
for help on using the changeset viewer.