From a15a8ac57d8af18ad002a58d318657d5b91c6c61 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 16 Jan 2017 21:06:38 +0100 Subject: [PATCH] BusLogic scatter/gather now processes 1 more block if the data length is not divisible by the length of a scatter/gather block. --- src/buslogic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/buslogic.c b/src/buslogic.c index 6cd9b318b..87634a0ec 100644 --- a/src/buslogic.c +++ b/src/buslogic.c @@ -821,9 +821,16 @@ void BuslogicDataBufferFree(BuslogicRequests_t *BuslogicRequests) uint32_t ScatterGatherRead; uint32_t ScatterEntry; SGE32 ScatterGatherBuffer[MAX_SG_DESCRIPTORS]; - uint32_t ScatterGatherLeft = DataLength / (BuslogicRequests->Is24bit ? sizeof(SGE) : sizeof(SGE32)); + uint32_t ScatterGatherReqSize = (BuslogicRequests->Is24bit ? sizeof(SGE) : sizeof(SGE32)); + uint32_t ScatterGatherLeft = DataLength / ScatterGatherReqSize; + uint32_t ScatterGatherLength = (ScatterGatherLeft * ScatterGatherReqSize); uint32_t ScatterGatherAddrCurrent = DataPointer; - + + if (DataLength > ScatterGatherLength) + { + ScatterGatherLeft++; + } + do { ScatterGatherRead = (ScatterGatherLeft < ELEMENTS(ScatterGatherBuffer))