7 #include "../common/plat.h"
10 int plat_is_dir(const char *path)
13 if ((dir = opendir(path))) {
20 unsigned int plat_get_ticks_ms(void)
25 gettimeofday(&tv, NULL);
27 ret = (unsigned)tv.tv_sec * 1000;
28 /* approximate division */
29 ret += ((unsigned)tv.tv_usec * 4195) >> 22;
34 void plat_sleep_ms(int ms)
39 int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
41 struct timeval tv, *timeout = NULL;
42 int i, ret, fdmax = -1;
45 if (timeout_ms >= 0) {
46 tv.tv_sec = timeout_ms / 1000;
47 tv.tv_usec = (timeout_ms % 1000) * 1000;
52 for (i = 0; i < count; i++) {
53 if (fds_hnds[i] > fdmax) fdmax = fds_hnds[i];
54 FD_SET(fds_hnds[i], &fdset);
57 ret = select(fdmax + 1, &fdset, NULL, NULL, timeout);
60 perror("plat_wait_event: select failed");
66 return -1; /* timeout */
69 for (i = 0; i < count; i++)
70 if (FD_ISSET(fds_hnds[i], &fdset))