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:
Gregory Nutt 2014-07-03 08:50:24 -06:00
parent 954048b8e9
commit 68f83f973e
3 changed files with 21 additions and 14 deletions

View File

@ -1658,6 +1658,15 @@ config STM32_CCMEXCLUDE
and (2) it appears to be impossible to execute ELF modules from CCM and (2) it appears to be impossible to execute ELF modules from CCM
RAM. 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 config STM32_DMACAPABLE
bool "Workaround non-DMA capable memory" bool "Workaround non-DMA capable memory"
depends on ARCH_DMA depends on ARCH_DMA

View File

@ -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_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_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_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) ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CHIP_ASRCS += stm32_vectors.S CHIP_ASRCS += stm32_vectors.S
@ -106,6 +105,10 @@ ifeq ($(CONFIG_NUTTX_KERNEL),y)
CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c
endif endif
ifeq ($(CONFIG_STM32_CCM_PROCFS),y)
CHIP_CSRCS += stm32_procfs_ccm.c
endif
ifeq ($(CONFIG_STM32_I2C_ALT),y) ifeq ($(CONFIG_STM32_I2C_ALT),y)
CHIP_CSRCS += stm32_i2c_alt.c CHIP_CSRCS += stm32_i2c_alt.c
else else

View File

@ -82,14 +82,11 @@
struct ccm_file_s struct ccm_file_s
{ {
struct procfs_file_s base; /* Base open file structure */ struct procfs_file_s base; /* Base open file structure */
unsigned int linesize; /* Number of valid characters in line[] */ unsigned int linesize; /* Number of valid characters in line[] */
char line[CCM_LINELEN]; /* Pre-allocated buffer for formatted lines */ char line[CCM_LINELEN]; /* Pre-allocated buffer for formatted lines */
/* Add context specific data types for managing an open file here */
}; };
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * 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 int ccm_close(FAR struct file *filep);
static ssize_t ccm_read(FAR struct file *filep, FAR char *buffer, static ssize_t ccm_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static int ccm_dup(FAR const struct file *oldp, static int ccm_dup(FAR const struct file *oldp,
FAR struct file *newp); FAR struct file *newp);
static int ccm_stat(FAR const char *relpath, FAR struct stat *buf); 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_open, /* open */
ccm_close, /* close */ ccm_close, /* close */
ccm_read, /* read */ ccm_read, /* read */
NULL, /* write */ NULL, /* write */
ccm_dup, /* dup */ ccm_dup, /* dup */
NULL, /* opendir */ NULL, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
NULL, /* readdir */ NULL, /* readdir */
NULL, /* rewinddir */ NULL, /* rewinddir */
ccm_stat /* stat */ ccm_stat /* stat */
}; };
@ -294,7 +289,7 @@ static int ccm_dup(FAR const struct file *oldp, FAR struct file *newp)
return -ENOMEM; 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)); memcpy(newpriv, oldpriv, sizeof(struct ccm_file_s));