[libsys]
- fixed usleep() git-svn-id: http://moon:8086/svn/mips@215 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -46,18 +46,18 @@ void sleep(unsigned ms)
|
||||
usleep(1000*ms);
|
||||
}
|
||||
|
||||
void usleep(unsigned us)
|
||||
void usleep(uint64_t us)
|
||||
{
|
||||
unsigned stop_us, stop_s, curr_us, curr_s;
|
||||
uint64_t stop_us, stop_s, curr_us, curr_s;
|
||||
struct timeval t;
|
||||
|
||||
if (!us)
|
||||
return;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
stop_s = (unsigned)t.tv_sec;
|
||||
stop_us = (unsigned)t.tv_usec + us;
|
||||
if (stop_us >= 1E6)
|
||||
stop_s = (uint64_t)t.tv_sec;
|
||||
stop_us = (uint64_t)t.tv_usec + us;
|
||||
while (stop_us >= 1E6)
|
||||
{
|
||||
stop_us -= 1E6;
|
||||
stop_s++;
|
||||
@@ -66,8 +66,8 @@ void usleep(unsigned us)
|
||||
do
|
||||
{
|
||||
gettimeofday(&t, NULL);
|
||||
curr_s = (unsigned)t.tv_sec;
|
||||
curr_us = (unsigned)t.tv_usec;
|
||||
curr_s = (uint64_t)t.tv_sec;
|
||||
curr_us = (uint64_t)t.tv_usec;
|
||||
} while ((curr_s < stop_s) || (curr_us < stop_us));
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void print_byte(char byte);
|
||||
void print_word(int word);
|
||||
void _exit (int exitcode);
|
||||
void sleep(unsigned ms);
|
||||
void usleep(unsigned us);
|
||||
void usleep(uint64_t us);
|
||||
|
||||
void PrintBuffer8(uint8_t *pBuf, int nbpr, int len);
|
||||
void memdump(uint8_t *pBuf, int print_offset_only, int num_bytes_per_row, int len);
|
||||
|
||||
Reference in New Issue
Block a user