From 548ba1640fa3dc781b3d86a5159d1f5d175044ed Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 1 Dec 2015 14:55:05 -0600 Subject: [PATCH] STM32: CCM procfs is no longer a part of the 'base' procfs entries and can now only be supported via run time registration with CONFIG_FS_PROCFS_REGISTER=y --- arch/arm/src/stm32/Kconfig | 2 +- arch/arm/src/stm32/stm32_ccm.h | 12 ++++++++ arch/arm/src/stm32/stm32_procfs_ccm.c | 41 +++++++++++++++++++++------ 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index a1afdf6e451..11a6ca3ff92 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -2448,7 +2448,7 @@ config STM32_CCMEXCLUDE config STM32_CCM_PROCFS bool "CCM PROCFS support" default n - depends on STM32_CCMEXCLUDE && FS_PROCFS + depends on !DISABLE_MOUNTPOINT && FS_PROCFS && FS_PROCFS_REGISTER ---help--- Select to build in support for /proc/ccm. Reading from /proc/ccm will provide statistics about CCM memory use similar to what you diff --git a/arch/arm/src/stm32/stm32_ccm.h b/arch/arm/src/stm32/stm32_ccm.h index c027c54a61c..2a4582f13ce 100644 --- a/arch/arm/src/stm32/stm32_ccm.h +++ b/arch/arm/src/stm32/stm32_ccm.h @@ -131,6 +131,18 @@ EXTERN struct mm_heap_s g_ccm_heap; } #endif +/**************************************************************************** + * Name: ccm_register + * + * Description: + * Register the CCM procfs file system entry + * + ****************************************************************************/ + +#ifdef CONFIG_STM32_CCM_PROCFS +int ccm_register(void); +#endif + #endif /* __ASSEMBLY__ */ #endif /* HAVE_CCM_HEAP */ #endif /* __ARCH_ARM_SRC_STM32_STM32_CCM_H */ diff --git a/arch/arm/src/stm32/stm32_procfs_ccm.c b/arch/arm/src/stm32/stm32_procfs_ccm.c index ee4d91624c1..2cddfe416fa 100644 --- a/arch/arm/src/stm32/stm32_procfs_ccm.c +++ b/arch/arm/src/stm32/stm32_procfs_ccm.c @@ -64,19 +64,18 @@ #include "stm32_ccm.h" -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) && \ + defined(CONFIG_FS_PROCFS_REGISTER) && defined(CONFIG_STM32_CCM_PROCFS) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + #define CCM_LINELEN 64 /**************************************************************************** * Private Types ****************************************************************************/ -/* This enumeration identifies all of the thread attributes that can be - * accessed via the procfs file system. - */ /* This structure describes one open "file" */ @@ -101,10 +100,6 @@ static int ccm_dup(FAR const struct file *oldp, FAR struct file *newp); static int ccm_stat(FAR const char *relpath, FAR struct stat *buf); -/**************************************************************************** - * Private Variables - ****************************************************************************/ - /**************************************************************************** * Public Data ****************************************************************************/ @@ -128,6 +123,16 @@ const struct procfs_operations ccm_procfsoperations = ccm_stat /* stat */ }; +/**************************************************************************** + * Private Data + ****************************************************************************/ + +const struct procfs_file_s g_procfs_ccm = +{ + "ccm", + &ccm_procfsoperations +}, + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -314,4 +319,22 @@ static int ccm_stat(const char *relpath, struct stat *buf) return OK; } -#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS */ +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ccm_register + * + * Description: + * Register the CCM procfs file system entry + * + ****************************************************************************/ + +int ccm_register(void) +{ + return procfs_register(&g_procfs_ccm); +} + +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS && + * CONFIG_FS_PROCFS_REGISTER && CONFIG_STM32_CCM_PROCFS */