From 8e0e4b064425c9c54e109191bba8bcf0775ba9ee Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 5 Nov 2018 20:13:58 +0000 Subject: Fixed memory mapped mode. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12410 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/LLD/OCTOSPIv1/hal_wspi_lld.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'os/hal/ports/STM32') diff --git a/os/hal/ports/STM32/LLD/OCTOSPIv1/hal_wspi_lld.c b/os/hal/ports/STM32/LLD/OCTOSPIv1/hal_wspi_lld.c index dc6c77eca..1b5088dc8 100644 --- a/os/hal/ports/STM32/LLD/OCTOSPIv1/hal_wspi_lld.c +++ b/os/hal/ports/STM32/LLD/OCTOSPIv1/hal_wspi_lld.c @@ -399,19 +399,31 @@ void wspi_lld_map_flash(WSPIDriver *wspip, /* Starting memory mapped mode using the passed parameters.*/ wspip->ospi->CR = (wspip->ospi->CR & ~OCTOSPI_CR_FMODE) | (OCTOSPI_CR_FMODE_1 | OCTOSPI_CR_FMODE_0); - wspip->ospi->DLR = 0U; wspip->ospi->TCR = cmdp->dummy; wspip->ospi->CCR = cmdp->cfg; - wspip->ospi->ABR = 0U; wspip->ospi->IR = cmdp->cmd; + wspip->ospi->ABR = 0U; wspip->ospi->AR = 0U; + wspip->ospi->WTCR = 0U; wspip->ospi->WCCR = 0U; wspip->ospi->WIR = 0U; + wspip->ospi->WABR = 0U; /* Mapped flash absolute base address.*/ - if (addrp != NULL) { - *addrp = (uint8_t *)0x90000000; +#if STM32_WSPI_USE_OCTOSPI1 + if (&WSPID1 == wspip) { + if (addrp != NULL) { + *addrp = (uint8_t *)0x90000000U; + } } +#endif +#if STM32_WSPI_USE_OCTOSPI2 + if (&WSPID2 == wspip) { + if (addrp != NULL) { + *addrp = (uint8_t *)0x70000000U; + } + } +#endif } /** -- cgit v1.2.3