arch/z80/src/ez80/ez80_spi.c: Fix a poorly constructed loop that would lead to hangs.
This commit is contained in:
parent
4bfa6fe511
commit
ad0181a6d4
@ -369,28 +369,26 @@ static int spi_transfer(uint8_t chout, FAR uint8_t *chin)
|
||||
uint8_t response;
|
||||
int ret;
|
||||
|
||||
/* Send the byte, repeating if some error occurs */
|
||||
/* Send the byte */
|
||||
|
||||
for (; ; )
|
||||
outp(EZ80_SPI_TSR, chout);
|
||||
|
||||
/* Wait for the device to be ready to accept another byte */
|
||||
|
||||
ret = spi_waitspif();
|
||||
if (ret < 0)
|
||||
{
|
||||
outp(EZ80_SPI_TSR, chout);
|
||||
|
||||
/* Wait for the device to be ready to accept another byte */
|
||||
|
||||
ret = spi_waitspif();
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: spi_waitspif returned %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
response = inp(EZ80_SPI_RBR);
|
||||
if (chin != NULL)
|
||||
{
|
||||
*chin = response;
|
||||
return OK;
|
||||
}
|
||||
spierr("ERROR: spi_waitspif returned %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
response = inp(EZ80_SPI_RBR);
|
||||
if (chin != NULL)
|
||||
{
|
||||
*chin = response;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user