bionic: Add _msleep and _usleep commands

Signed-off-by: Sean Cross <xobs@kosagi.com>
This commit is contained in:
Sean Cross 2014-11-25 17:08:48 +08:00
parent d93e92acda
commit b5829b9694
2 changed files with 22 additions and 1 deletions

View file

@ -703,3 +703,23 @@ int _strnlen(const char *s, uint32_t maxlen)
while(s[i++] && i < maxlen); while(s[i++] && i < maxlen);
return i; return i;
} }
void _usleep(uint32_t usecs)
{
uint32_t i, j;
for (i = 0; i < usecs; i++) {
for (j = 0; j < 73; j++) {
asm("nop");
}
}
}
void _msleep(uint32_t msecs)
{
uint32_t i, j;
for (i = 0; i < msecs; i++) {
for (j = 0; j < 73000; j++) {
asm("nop");
}
}
}

View file

@ -13,7 +13,8 @@ void _memset(void *dst0, char val, size_t length);
unsigned long _strtoul(const void *nptr, void **endptr, int base); unsigned long _strtoul(const void *nptr, void **endptr, int base);
int _strlen(const char *s); int _strlen(const char *s);
int _strnlen(const char *s, uint32_t maxlen); int _strnlen(const char *s, uint32_t maxlen);
void _usleep(uint32_t usecs);
void _msleep(uint32_t msecs);
/* ctype replacements */ /* ctype replacements */
int _isspace(char c); int _isspace(char c);