Merged in david_s5/nuttx/master_stm32_flash (pull request #474)

stm32 FLASH allow non blocking operation on constrained devices

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
David Sidrane 2017-08-31 18:04:07 +00:00 committed by Gregory Nutt
commit 9fc283526a
2 changed files with 15 additions and 1 deletions

View File

@ -2832,6 +2832,14 @@ config STM32_FLASH_PREFETCH
on F1 parts). Some early revisions of F4 parts do not support FLASH pre-fetch
properly and enabling this option may interfere with ADC accuracy.
config STM32_FLASH_NONBLOCKING
bool "Remove Blocking operation in FLASH driver"
default n
---help---
Enable this on single task platforms to conserve code space.
It removes the sem_wait and post operations that are not
needed in a single task environment.
config STM32_FLASH_WORKAROUND_DATA_CACHE_CORRUPTION_ON_RWW
bool "Workaround for FLASH data cache corruption"
default n

View File

@ -100,23 +100,29 @@
* Private Data
************************************************************************************/
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
static sem_t g_sem = SEM_INITIALIZER(1);
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
static void sem_lock(void)
static inline void sem_lock(void)
{
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
while (sem_wait(&g_sem) < 0)
{
DEBUGASSERT(errno == EINTR);
}
#endif
}
static inline void sem_unlock(void)
{
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
sem_post(&g_sem);
#endif
}
#if !defined(CONFIG_STM32_STM32L15XX)