2 Bugs in bcm2835_aux_spi_transfernb

27 views
Skip to first unread message

Sean Goff

unread,
Feb 9, 2024, 5:24:57 PM2/9/24
to bcm2835
First Bug:
In bcm2835_aux_spi_transfernb it's possible for the RX FIFO to overflow, for example if the process is interrupted between filling the TX FIFO and reading the RX FIFO.

The RX FIFO might still have data in it (and thus have less than 4 slots available), but the TX FIFO just got loaded with 4 words. This then causes the RX FIFO to overflow before the process gets control back from the scheduler.

Second Bug:
if the TX FIFO gets starved, BCM2835_AUX_SPI_STAT_BUSY can become false while tx_len is > 0. In that case the program reads garbage data from RX FIFO before refilling TX FIFO.

Patch for both bugs is attached.
bcm2835_aux_spi_transfernb.patch

Mike McCauley

unread,
Feb 11, 2024, 9:31:48 PM2/11/24
to bcm2835, Sean Goff
Thanks, your patch is no in the latest version.
Needed a little editing, so please check its still OK for you?

Cheers.
--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com 5R3MRFM2+X6
Phone +61 7 5598-7474



Reply all
Reply to author
Forward
0 new messages