| 142 | | static inline void |
| 143 | | ioport_sleep(const struct timespec nap) |
| 144 | | { |
| 145 | | struct timeval nap_for; |
| 146 | | u_int32_t usec; |
| 147 | | time_t i; |
| 148 | | |
| 149 | | TIMESPEC_TO_TIMEVAL(&nap_for, &nap); |
| 150 | | |
| 151 | | /* |
| 152 | | * process the seconds, we do this in a loop so we don't have to |
| 153 | | * use slower 64bit integers or worry about integer overflows. |
| 154 | | */ |
| 155 | | for (i = 0; i < nap_for.tv_sec; i ++) { |
| 156 | | usec = SEC_TO_MICROSEC(nap_for.tv_sec); |
| 157 | | while (usec > 0) { |
| 158 | | usec --; |
| 159 | | outb(ioport_sleep_value, 0x80); |
| 160 | | } |
| 161 | | } |
| 162 | | |
| 163 | | /* process the usec */ |
| 164 | | usec = nap.tv_nsec / 1000; |
| 165 | | usec --; /* fudge factor for all the above */ |
| 166 | | while (usec > 0) { |
| 167 | | usec --; |
| 168 | | outb(ioport_sleep_value, 0x80); |
| 169 | | } |
| 170 | | } |
| | 142 | void ioport_sleep(const struct timespec nap); |