1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Make SPI access chaining more resilient to driver coding errors as fixed in 8474a6eb

This commit is contained in:
Steve Evans 2022-10-16 19:57:00 +01:00
parent 8474a6eb7d
commit b18a114e45
3 changed files with 7 additions and 4 deletions

View file

@ -415,6 +415,7 @@ static void spiIrqHandler(const extDevice_t *dev)
// The end of the segment list has been reached
bus->curSegment = nextSegments;
nextSegment->u.link.dev = NULL;
nextSegment->u.link.segments = NULL;
spiSequenceStart(nextDev);
} else {
// The end of the segment list has been reached, so mark transactions as complete

View file

@ -691,11 +691,12 @@ void spiSequenceStart(const extDevice_t *dev)
// If a following transaction has been linked, start it
if (bus->curSegment->u.link.dev) {
const extDevice_t *nextDev = bus->curSegment->u.link.dev;
busSegment_t *nextSegments = (busSegment_t *)bus->curSegment->u.link.segments;
busSegment_t *endSegment = (busSegment_t *)bus->curSegment;
const extDevice_t *nextDev = endSegment->u.link.dev;
busSegment_t *nextSegments = (busSegment_t *)endSegment->u.link.segments;
bus->curSegment = nextSegments;
endSegment->u.link.dev = NULL;
endSegment->u.link.segments = NULL;
spiSequenceStart(nextDev);
} else {
// The end of the segment list has been reached, so mark transactions as complete

View file

@ -418,11 +418,12 @@ void spiSequenceStart(const extDevice_t *dev)
// If a following transaction has been linked, start it
if (bus->curSegment->u.link.dev) {
const extDevice_t *nextDev = bus->curSegment->u.link.dev;
busSegment_t *nextSegments = (busSegment_t *)bus->curSegment->u.link.segments;
busSegment_t *endSegment = (busSegment_t *)bus->curSegment;
const extDevice_t *nextDev = endSegment->u.link.dev;
busSegment_t *nextSegments = (busSegment_t *)endSegment->u.link.segments;
bus->curSegment = nextSegments;
endSegment->u.link.dev = NULL;
endSegment->u.link.segments = NULL;
spiSequenceStart(nextDev);
} else {
// The end of the segment list has been reached, so mark transactions as complete