From b26526fe068782ce5e5d1432300223ab59601343 Mon Sep 17 00:00:00 2001 From: Thomas Roell Date: Mon, 13 Jun 2016 16:38:34 -0600 Subject: [PATCH] fix DMA resource tracking by properly masking off the channel index --- system/libstm32l4_dragonfly/stm32l4_dma.c | 16 ++++++++++------ variants/dragonfly/libstm32l4_dragonfly.a | Bin 1106064 -> 1106260 bytes 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/system/libstm32l4_dragonfly/stm32l4_dma.c b/system/libstm32l4_dragonfly/stm32l4_dma.c index 659788ff..dd997a0f 100644 --- a/system/libstm32l4_dragonfly/stm32l4_dma.c +++ b/system/libstm32l4_dragonfly/stm32l4_dma.c @@ -89,17 +89,19 @@ static void stm32l4_dma_track(uint32_t channel, uint32_t address) { if (address < 0x40000000) { + uint32_t mask = (1ul << (channel & 15)); + if (address >= 0x20000000) { - stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_SRAM1, &stm32l4_dma_driver.sram1, (1ul << channel)); + stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_SRAM1, &stm32l4_dma_driver.sram1, mask); } else if (address >= 0x10000000) { - stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_SRAM2, &stm32l4_dma_driver.sram2, (1ul << channel)); + stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_SRAM2, &stm32l4_dma_driver.sram2, mask); } else { - stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_FLASH, &stm32l4_dma_driver.flash, (1ul << channel)); + stm32l4_system_periph_cond_wake(SYSTEM_PERIPH_FLASH, &stm32l4_dma_driver.flash, mask); } } } @@ -108,17 +110,19 @@ static void stm32l4_dma_untrack(uint32_t channel, uint32_t address) { if (address < 0x40000000) { + uint32_t mask = (1ul << (channel & 15)); + if (address >= 0x20000000) { - stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_SRAM1, &stm32l4_dma_driver.sram1, (1ul << channel)); + stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_SRAM1, &stm32l4_dma_driver.sram1, mask); } else if (address >= 0x10000000) { - stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_SRAM2, &stm32l4_dma_driver.sram2, (1ul << channel)); + stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_SRAM2, &stm32l4_dma_driver.sram2, mask); } else { - stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_FLASH, &stm32l4_dma_driver.flash, (1ul << channel)); + stm32l4_system_periph_cond_sleep(SYSTEM_PERIPH_FLASH, &stm32l4_dma_driver.flash, mask); } } } diff --git a/variants/dragonfly/libstm32l4_dragonfly.a b/variants/dragonfly/libstm32l4_dragonfly.a index d232cf29751e35ecdffb328de000697b7af97d1c..5cc704e0777208e3d1de58872cff29c93f00080d 100644 GIT binary patch delta 11600 zcmcIq33OCNx~}Ra+wG*g6VjbPLN<~>2uV7Gkc1EtHdz7*3?Lx8psWfS5k=|9ASfcs zfRyuI6coo%QFwsTj1Lq98GIu9xD5`-L&bAYK|s+#ecylY-^uMh&o|6Gy(iUQ{d@g& z>sHmhm6dyXop__y%9Mz*E?qm9`?h4Bw)>9@q5TWRk-bCw62%|lei8fUVZUgJ+f^d2zxc0T*;#c`{Nly`b57ri63+i;arHYX{!#IV zC~P<{T>o3yJ5RWNo#Ows9ABqj|F4$W^)(>x`nz@YxQ21t7RFpH)TfWK&f6L*TGs~a z>lZKRW2b4QOx2u?@ouX)c%hex4)k@&1CAC(QlMk1jGSO*)ZH%+4{l+20~H75$r>}G zIL?xvXJ*`6W;w8w85w0-QegaE%Z4s33~!+Acb4`WTNp`!o1d}XT-L(y2F{$co_MZ> zkrX)opzTtq#%s2c)D{hIp!lS%cN;U~ci-ApW||pQt?m1*%Af-|BnhvB23`+GJ@N?FtOI zU0WI1d6wK6DMXuBqlJ*OTvk-0ZNX|v>Z??rLu?^hcZ>lsQl4LXx0dW@*%(9C_M8Q> zg``%3BAW`Mgh-n_Ya*EQ;h(PbQRHkP$tXDnmAN)WPX4jg1Y4%T>( znHx}PL?sJFkb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