void erpc::spiWaitForSlaveReadyGpio(int gpioHandle)
{
for (;;)
{
if (gpio_poll(gpioHandle, -1))
{
break;
}
}
}
hangs master.
No hangs.
int gpio_poll(int fd, int timeout) // 0/1 - new pin state, -2 - error, -1 - timeout
{
int pollr;
struct pollfd fds;
int ret;
char val;
fds.fd = fd;
fds.events = POLLIN | POLLPRI | POLLERR;
;
pollr = poll(&fds, 1, timeout);
if (pollr < 0)
{
(void)fprintf(stderr, "Could not poll gpio (%d).\r\n", errno);
ret = -2;
}
else
{
if ((fds.revents & (POLLPRI | POLLIN) ) > 0)
{
lseek(fds.fd, 0, SEEK_SET);
read(fds.fd, &val, 1);
ret = val-'0';
}
else if ((fds.revents & POLLERR) > 0)
{
(void)fprintf(stderr, "Error while polling gpio (%d).\r\n", errno);
ret = -2;
}
else
{
ret = -1;
}
}
return ret;
}
/***********************/
void erpc::spiWaitForSlaveReadyGpio(int gpioHandle)
{
for (;;)
{
if (gpio_poll(gpioHandle, -1) == 0)
{
break;
}
}
}
Description of problem: gpio_poll() hangs master
Using gpio_poll() as that
hangs master.
To Reproduce
I got that behaviour when
erpc_c/transports/erpc_spidev_master_transport.cpp
was tested with gpio synchronization turned on.
Expected behavior
No hangs.
Screenshots
Desktop (please complete the following information)
Steps you didn't forgot to do
Additional context
That's modification works fine: