CCM PROCFS: Changed the configuration a bit. I am still not happy about the coupling between procfs, mtd, and now STM32
This commit is contained in:
parent
64cd7a81ed
commit
dd4caf172f
@ -1658,6 +1658,15 @@ config STM32_CCMEXCLUDE
|
||||
and (2) it appears to be impossible to execute ELF modules from CCM
|
||||
RAM.
|
||||
|
||||
config STM32_CCM_PROCFS
|
||||
bool "CCM PROCFS support"
|
||||
default n
|
||||
depends on STM32_CCMEXCLUDE && MM_MULTIHEAP && FS_PROCFS
|
||||
---help---
|
||||
Select to build in support for /proc/ccm. Reading from /proc/ccm
|
||||
will provide statistics about CCM memory use similar to what you
|
||||
would get from mallinfo() for the user heap.
|
||||
|
||||
config STM32_DMACAPABLE
|
||||
bool "Workaround non-DMA capable memory"
|
||||
depends on ARCH_DMA
|
||||
|
@ -96,7 +96,6 @@ CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c
|
||||
CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c
|
||||
CHIP_CSRCS += stm32_timerisr.c stm32_dma.c stm32_lowputc.c stm32_serial.c
|
||||
CHIP_CSRCS += stm32_spi.c stm32_sdio.c stm32_tim.c stm32_waste.c stm32_ccm.c
|
||||
CHIP_CSRCS += stm32_procfs_ccm.c
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
|
||||
CHIP_ASRCS += stm32_vectors.S
|
||||
@ -106,6 +105,10 @@ ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_CCM_PROCFS),y)
|
||||
CHIP_CSRCS += stm32_procfs_ccm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_I2C_ALT),y)
|
||||
CHIP_CSRCS += stm32_i2c_alt.c
|
||||
else
|
||||
|
@ -82,14 +82,11 @@
|
||||
|
||||
struct ccm_file_s
|
||||
{
|
||||
struct procfs_file_s base; /* Base open file structure */
|
||||
unsigned int linesize; /* Number of valid characters in line[] */
|
||||
struct procfs_file_s base; /* Base open file structure */
|
||||
unsigned int linesize; /* Number of valid characters in line[] */
|
||||
char line[CCM_LINELEN]; /* Pre-allocated buffer for formatted lines */
|
||||
|
||||
/* Add context specific data types for managing an open file here */
|
||||
};
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
@ -100,10 +97,8 @@ static int ccm_open(FAR struct file *filep, FAR const char *relpath,
|
||||
static int ccm_close(FAR struct file *filep);
|
||||
static ssize_t ccm_read(FAR struct file *filep, FAR char *buffer,
|
||||
size_t buflen);
|
||||
|
||||
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);
|
||||
|
||||
/****************************************************************************
|
||||
@ -124,12 +119,12 @@ const struct procfs_operations ccm_procfsoperations =
|
||||
ccm_open, /* open */
|
||||
ccm_close, /* close */
|
||||
ccm_read, /* read */
|
||||
NULL, /* write */
|
||||
NULL, /* write */
|
||||
ccm_dup, /* dup */
|
||||
NULL, /* opendir */
|
||||
NULL, /* closedir */
|
||||
NULL, /* readdir */
|
||||
NULL, /* rewinddir */
|
||||
NULL, /* opendir */
|
||||
NULL, /* closedir */
|
||||
NULL, /* readdir */
|
||||
NULL, /* rewinddir */
|
||||
ccm_stat /* stat */
|
||||
};
|
||||
|
||||
@ -294,7 +289,7 @@ static int ccm_dup(FAR const struct file *oldp, FAR struct file *newp)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* The copy the file attribtes from the old attributes to the new */
|
||||
/* The copy the file attributes from the old attributes to the new */
|
||||
|
||||
memcpy(newpriv, oldpriv, sizeof(struct ccm_file_s));
|
||||
|
||||
|
@ -55,10 +55,9 @@ config FS_PROCFS_EXCLUDE_SMARTFS
|
||||
default n
|
||||
|
||||
config FS_PROCFS_EXCLUDE_CCM
|
||||
bool "Exclude ccm memory usage"
|
||||
depends on STM32_CCMEXCLUDE
|
||||
default n
|
||||
bool "Exclude CCM memory usage"
|
||||
depends on STM32_CCM_PROCFS
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
endmenu #
|
||||
endif # FS_PROCFS
|
||||
|
@ -78,10 +78,21 @@
|
||||
extern const struct procfs_operations proc_operations;
|
||||
extern const struct procfs_operations cpuload_operations;
|
||||
extern const struct procfs_operations uptime_operations;
|
||||
|
||||
/* This is not good. These are implemented in drivers/mtd. Having to
|
||||
* deal with them here is not a good coupling.
|
||||
*/
|
||||
|
||||
extern const struct procfs_operations mtd_procfsoperations;
|
||||
extern const struct procfs_operations part_procfsoperations;
|
||||
extern const struct procfs_operations smartfs_procfsoperations;
|
||||
#if defined(CONFIG_STM32_CCMEXCLUDE) && defined(CONFIG_MM_MULTIHEAP) && !defined(FS_PROCFS_EXCLUDE_CCM)
|
||||
|
||||
/* And even worse, this one is specific to the STM32. The solution to
|
||||
* this nasty couple would be to replace this hard-coded, ROM-able
|
||||
* operations table with a RAM-base registration table.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_STM32_CCM_PROCFS)
|
||||
extern const struct procfs_operations ccm_procfsoperations;
|
||||
#endif
|
||||
|
||||
@ -117,7 +128,8 @@ static const struct procfs_entry_s g_procfsentries[] =
|
||||
#if !defined(CONFIG_FS_PROCFS_EXCLUDE_UPTIME)
|
||||
{ "uptime", &uptime_operations },
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_CCMEXCLUDE) && defined(CONFIG_MM_MULTIHEAP) && !defined(FS_PROCFS_EXCLUDE_CCM)
|
||||
|
||||
#if defined(#if defined(CONFIG_STM32_CCM_PROCFS)
|
||||
{ "ccm", &ccm_procfsoperations },
|
||||
#endif
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user