Replacing usleep with px4_usleep

This is a step towards isolating time from the system.
This commit is contained in:
Julian Oes
2018-12-22 10:32:18 +01:00
parent e485885344
commit 5b9dea5604
112 changed files with 339 additions and 305 deletions
+8 -8
View File
@@ -300,7 +300,7 @@ GPS::~GPS()
unsigned int i = 0;
do {
usleep(20000); // 20 ms
px4_usleep(20000); // 20 ms
++i;
} while (_secondary_instance && i < 100);
}
@@ -400,11 +400,11 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
err = ioctl(_serial_fd, FIONREAD, (unsigned long)&bytes_available);
if (err != 0 || bytes_available < (int)character_count) {
usleep(sleeptime);
px4_usleep(sleeptime);
}
#else
usleep(sleeptime);
px4_usleep(sleeptime);
#endif
ret = ::read(_serial_fd, buf, buf_length);
@@ -419,7 +419,7 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
#else
/* For QURT, just use read for now, since this doesn't block, we need to slow it down
* just a bit. */
usleep(10000);
px4_usleep(10000);
return ::read(_serial_fd, buf, buf_length);
#endif
}
@@ -693,7 +693,7 @@ GPS::run()
publish();
usleep(200000);
px4_usleep(200000);
} else {
@@ -810,7 +810,7 @@ GPS::run()
case GPS_DRIVER_MODE_ASHTECH:
_mode = GPS_DRIVER_MODE_UBX;
usleep(500000); // tried all possible drivers. Wait a bit before next round
px4_usleep(500000); // tried all possible drivers. Wait a bit before next round
break;
default:
@@ -818,7 +818,7 @@ GPS::run()
}
} else {
usleep(500000);
px4_usleep(500000);
}
}
@@ -1139,7 +1139,7 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance)
do {
/* wait up to 1s */
usleep(2500);
px4_usleep(2500);
} while (!_secondary_instance && ++i < 400);