1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Fix chaining of FLASH SPI transactions

This commit is contained in:
Steve Evans 2022-10-16 13:21:59 +01:00
parent 8462dd1bea
commit 8474a6eb7d

View file

@ -356,6 +356,13 @@ static uint32_t m25p16_pageProgramContinue(flashDevice_t *fdevice, uint8_t const
segments[DATA1].len = bufferSizes[0];
fdevice->callbackArg = bufferSizes[0];
/* As the DATA2 segment may be used as the terminating segment, the rxData and txData may be overwritten
* with a link to the following transaction (u.link.dev and u.link.segments respectively) so ensure that
* rxData is reinitialised otherwise it will remain pointing at a chained u.link.segments structure which
* would result in it being corrupted.
*/
segments[DATA2].u.buffers.rxData = (uint8_t *)NULL;
if (bufferCount == 1) {
segments[DATA1].negateCS = true;
segments[DATA1].callback = m25p16_callbackWriteComplete;