Dirk Hohndel
2018-09-10 05:05:01 UTC
This should be so simple. libtfdi is available in MXE, so just build against it, right?
Except this:
static dc_status_t serial_ftdi_sleep (void *io, unsigned int timeout)
{
ftdi_serial_t *device = io;
if (device == NULL)
return DC_STATUS_INVALIDARGS;
INFO (device->context, "Sleep: value=%u", timeout);
struct timespec ts;
ts.tv_sec = (timeout / 1000);
ts.tv_nsec = (timeout % 1000) * 1000000;
while (nanosleep (&ts, &ts) != 0) {
if (errno != EINTR ) {
SYSERROR (device->context, errno);
return DC_STATUS_IO;
}
}
return DC_STATUS_SUCCESS;
}
Turns out Windows doesn't have nanosleep. And I can't seem to find a function with comparable semantic, unless I use the one in the pthread library that is provided by MinGW which is not what we want to do.
So the question becomes how to represent this with something that gives us the same semantic / functionality.
I am anything but a Windows expert. Suggestions welcome.
Thanks
/D
Except this:
static dc_status_t serial_ftdi_sleep (void *io, unsigned int timeout)
{
ftdi_serial_t *device = io;
if (device == NULL)
return DC_STATUS_INVALIDARGS;
INFO (device->context, "Sleep: value=%u", timeout);
struct timespec ts;
ts.tv_sec = (timeout / 1000);
ts.tv_nsec = (timeout % 1000) * 1000000;
while (nanosleep (&ts, &ts) != 0) {
if (errno != EINTR ) {
SYSERROR (device->context, errno);
return DC_STATUS_IO;
}
}
return DC_STATUS_SUCCESS;
}
Turns out Windows doesn't have nanosleep. And I can't seem to find a function with comparable semantic, unless I use the one in the pthread library that is provided by MinGW which is not what we want to do.
So the question becomes how to represent this with something that gives us the same semantic / functionality.
I am anything but a Windows expert. Suggestions welcome.
Thanks
/D