From d2fd5e74c5b104dc49f3ded01bc3a4b33742ee17 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 8 Dec 2013 13:05:30 -0800 Subject: [PATCH] Change SGPIO DMA configuration API from dividing up a buffer's length into M parts to creating a chain of M transfers of size N. --- firmware/common/sgpio_dma.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/firmware/common/sgpio_dma.c b/firmware/common/sgpio_dma.c index 18366beb..a47ecd8c 100644 --- a/firmware/common/sgpio_dma.c +++ b/firmware/common/sgpio_dma.c @@ -34,15 +34,14 @@ static void configure_dma_lli( const size_t lli_count, const bool direction_transmit, void* const buffer, - const size_t byte_count + const size_t transfer_bytes ) { - const size_t transfer_bytes = 4; - const size_t transfer_size = byte_count / lli_count / transfer_bytes; - const size_t transfer_size_bytes = transfer_size * transfer_bytes; + const size_t bytes_per_word = 4; + const size_t transfer_words = (transfer_bytes + bytes_per_word - 1) / bytes_per_word; for(size_t i=0; i