Fixed some nxstyle errors

This commit is contained in:
John Rippetoe 2020-04-01 12:26:00 -04:00 committed by Xiang Xiao
parent acb16e087a
commit 2f54204035
3 changed files with 152 additions and 144 deletions

View File

@ -204,8 +204,8 @@ uint8_t mpu_log2regionfloor(size_t size);
*
* Description:
* Given (1) the offset to the beginning of valid data, (2) the size of the
* memory to be mapped and (2) the log2 size of the mapping to use, determine
* the minimal sub-region set to span that memory region.
* memory to be mapped and (2) the log2 size of the mapping to use,
* determine the minimal sub-region set to span that memory region.
*
* Assumption:
* l2size has the same properties as the return value from

View File

@ -1,4 +1,4 @@
/****************************************************************************
/*****************************************************************************
* arch/arm/src/armv7-m/up_mpu.c
*
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
*****************************************************************************/
/****************************************************************************
/*****************************************************************************
* Included Files
****************************************************************************/
*****************************************************************************/
#include <nuttx/config.h>
@ -45,19 +45,19 @@
#include "mpu.h"
#include "up_internal.h"
/****************************************************************************
/*****************************************************************************
* Pre-processor Definitions
****************************************************************************/
*****************************************************************************/
/* Configuration ************************************************************/
/* Configuration *************************************************************/
#ifndef CONFIG_ARM_MPU_NREGIONS
# define CONFIG_ARM_MPU_NREGIONS 8
#endif
/****************************************************************************
/*****************************************************************************
* Private Data
****************************************************************************/
*****************************************************************************/
/* These sets represent the set of disabled memory sub-regions. A bit set
* corresponds to a disabled sub-region; the LS bit corresponds to the first
@ -87,11 +87,11 @@ static const uint8_t g_ls_regionmask[9] =
static uint8_t g_region;
/****************************************************************************
/*****************************************************************************
* Private Functions
****************************************************************************/
*****************************************************************************/
/****************************************************************************
/*****************************************************************************
* Name: mpu_subregion_ms
*
* Description:
@ -103,7 +103,7 @@ static uint8_t g_region;
* l2size has the same properties as the return value from
* mpu_log2regionceil()
*
****************************************************************************/
*****************************************************************************/
static inline uint32_t mpu_subregion_ms(size_t size, uint8_t l2size)
{
@ -141,7 +141,7 @@ static inline uint32_t mpu_subregion_ms(size_t size, uint8_t l2size)
return g_ms_regionmask[nsrs];
}
/****************************************************************************
/*****************************************************************************
* Name: mpu_subregion_ls
*
* Description:
@ -154,7 +154,7 @@ static inline uint32_t mpu_subregion_ms(size_t size, uint8_t l2size)
* l2size has the same properties as the return value from
* mpu_log2regionceil()
*
****************************************************************************/
*****************************************************************************/
static inline uint32_t mpu_subregion_ls(size_t offset, uint8_t l2size)
{
@ -192,11 +192,11 @@ static inline uint32_t mpu_subregion_ls(size_t offset, uint8_t l2size)
return g_ls_regionmask[nsrs];
}
/****************************************************************************
/*****************************************************************************
* Public Functions
****************************************************************************/
*****************************************************************************/
/****************************************************************************
/*****************************************************************************
* Name: mpu_allocregion
*
* Description:
@ -207,7 +207,7 @@ static inline uint32_t mpu_subregion_ls(size_t offset, uint8_t l2size)
* - Regions are only allocated early in initialization, so no special
* protection against re-entrancy is required;
*
****************************************************************************/
*****************************************************************************/
unsigned int mpu_allocregion(void)
{
@ -215,7 +215,7 @@ unsigned int mpu_allocregion(void)
return (unsigned int)g_region++;
}
/****************************************************************************
/*****************************************************************************
* Name: mpu_log2regionceil
*
* Description:
@ -224,7 +224,7 @@ unsigned int mpu_allocregion(void)
*
* size <= (1 << l2size)
*
****************************************************************************/
*****************************************************************************/
uint8_t mpu_log2regionceil(size_t size)
{
@ -236,7 +236,7 @@ uint8_t mpu_log2regionceil(size_t size)
return l2size;
}
/****************************************************************************
/*****************************************************************************
* Name: mpu_log2regionfloor
*
* Description:
@ -245,7 +245,7 @@ uint8_t mpu_log2regionceil(size_t size)
*
* size >= (1 << l2size)
*
****************************************************************************/
*****************************************************************************/
uint8_t mpu_log2regionfloor(size_t size)
{
@ -259,7 +259,7 @@ uint8_t mpu_log2regionfloor(size_t size)
return l2size;
}
/****************************************************************************
/*****************************************************************************
* Name: mpu_subregion
*
* Description:
@ -271,7 +271,7 @@ uint8_t mpu_log2regionfloor(size_t size)
* l2size has the same properties as the return value from
* mpu_log2regionceil()
*
****************************************************************************/
*****************************************************************************/
uint32_t mpu_subregion(uintptr_t base, size_t size, uint8_t l2size)
{

View File

@ -1,4 +1,4 @@
/****************************************************************************
/******************************************************************************
* arch/arm/src/stm32/stm32_allocateheap.c
*
* Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
******************************************************************************/
/****************************************************************************
/******************************************************************************
* Included Files
****************************************************************************/
******************************************************************************/
#include <nuttx/config.h>
@ -60,9 +60,10 @@
#include "stm32_mpuinit.h"
/****************************************************************************
/******************************************************************************
* Pre-processor Definitions
****************************************************************************/
******************************************************************************/
/* Internal SRAM is available in all members of the STM32 family. The
* following definitions must be provided to specify the size and
* location of internal(system) SRAM:
@ -76,9 +77,9 @@
*
* CONFIG_STM32_CCMEXCLUDE : Exclude CCM SRAM from the HEAP
*
* In addition to internal SRAM, external RAM may also be available through the
* FMC/FSMC. To use external RAM, the following things need to be present in
* the NuttX configuration file:
* In addition to internal SRAM, external RAM may also be available through
* the FMC/FSMC. To use external RAM, the following things need to be present
* in the NuttX configuration file:
*
* CONFIG_STM32_FSMC=y : Enables the FSMC
* CONFIG_STM32_FMC=y : Enables the FMC
@ -95,8 +96,9 @@
# undef CONFIG_STM32_EXTERNAL_RAM
#endif
/* The STM32L15xxx family has only internal SRAM. The heap is in one contiguous
* block starting at g_idle_topstack and extending through CONFIG_RAM_END.
/* The STM32L15xxx family has only internal SRAM. The heap is in one
* contiguous block starting at g_idle_topstack and extending through
* CONFIG_RAM_END.
*/
#if defined(CONFIG_STM32_STM32L15XX)
@ -105,7 +107,9 @@
# define SRAM1_END CONFIG_RAM_END
/* There is no FSMC (Other EnergyLite STM32's do have an FSMC, but not the STM32L15X */
/* There is no FSMC (Other EnergyLite STM32's do have an FSMC, but not
* the STM32L15X
*/
# undef CONFIG_STM32_EXTERNAL_RAM
@ -120,9 +124,10 @@
# error "CONFIG_MM_REGIONS > 1. The STM32L15X has only one memory region."
# endif
/* For the STM312F10xxx family, all internal SRAM is in one contiguous block
* starting at g_idle_topstack and extending through CONFIG_RAM_END (my apologies
* for the bad naming). In addition, external FSMC SRAM may be available.
/* For the STM312F10xxx family, all internal SRAM is in one contiguous
* block starting at g_idle_topstack and extending through CONFIG_RAM_END
* (my apologies for the bad naming). In addition, external FSMC SRAM
* may be available.
*/
#elif defined(CONFIG_STM32_STM32F10XX)
@ -323,19 +328,19 @@
* 1) 112KiB of System SRAM beginning at address 0x2000:0000
* 2) 16KiB of System SRAM beginning at address 0x2001:c000
*
* The STM32F401 family is an exception and has only 64KiB or 96Kib total on one
* bank:
* The STM32F401 family is an exception and has only 64KiB or 96Kib total
* on one bank:
*
* 3) 64KiB (STM32F401xB/C) or 96KiB (STM32401xD/E) of System SRAM beginning
* at address 0x2000:0000
* 3) 64KiB (STM32F401xB/C) or 96KiB (STM32401xD/E) of System SRAM
* beginning at address 0x2000:0000
*
* Members of the STM32F40xxx family have an additional 64Kib of CCM RAM
* for a total of 192KB.
*
* 4) 64Kib of CCM SRAM beginning at address 0x1000:0000
*
* The STM32F427/437/429/439 parts have another 64KiB of System SRAM for a total
* of 256KiB.
* The STM32F427/437/429/439 parts have another 64KiB of System SRAM for
* a total of 256KiB.
*
* 5) 64Kib of System SRAM beginning at address 0x2002:0000
*
@ -344,9 +349,10 @@
* regions are contiguous and treated as one in this logic that extends to
* 0x2002:0000 (or 0x2003:0000 for the F427/F437/F429/F439).
*
* As a complication, CCM SRAM cannot be used for DMA. So, if STM32 DMA is enabled,
* CCM SRAM should probably be excluded from the heap or the application must take
* extra care to ensure that DMA buffers are not allocated in CCM SRAM.
* As a complication, CCM SRAM cannot be used for DMA. So, if STM32 DMA is
* enabled, CCM SRAM should probably be excluded from the heap or the
* application must take extra care to ensure that DMA buffers are not
* allocated in CCM SRAM.
*
* In addition, external FSMC SRAM may be available.
*/
@ -466,8 +472,8 @@
# elif !defined(CONFIG_STM32_CCMEXCLUDE)
/* Configuration 2: FSMC SRAM is not used, but CCM SRAM is requested. DMA
* should be disabled and CONFIG_MM_REGIONS should be 2.
/* Configuration 2: FSMC SRAM is not used, but CCM SRAM is requested.
* DMA should be disabled and CONFIG_MM_REGIONS should be 2.
*/
# ifdef CONFIG_ARCH_DMA
@ -503,17 +509,17 @@
# endif
#endif
/****************************************************************************
/******************************************************************************
* Private Functions
****************************************************************************/
******************************************************************************/
/****************************************************************************
/******************************************************************************
* Name: up_heap_color
*
* Description:
* Set heap memory to a known, non-zero state to checking heap usage.
*
****************************************************************************/
******************************************************************************/
#ifdef CONFIG_HEAP_COLORATION
static inline void up_heap_color(FAR void *start, size_t size)
@ -524,11 +530,11 @@ static inline void up_heap_color(FAR void *start, size_t size)
# define up_heap_color(start,size)
#endif
/****************************************************************************
/******************************************************************************
* Public Functions
****************************************************************************/
******************************************************************************/
/****************************************************************************
/******************************************************************************
* Name: up_allocate_heap
*
* Description:
@ -550,16 +556,16 @@ static inline void up_heap_color(FAR void *start, size_t size)
*
* The following memory map is assumed for the kernel build:
*
* Kernel .data region. Size determined at link time.
* Kernel .bss region Size determined at link time.
* Kernel IDLE thread stack. Size determined by CONFIG_IDLETHREAD_STACKSIZE.
* Kernel .data region Size determined at link time
* Kernel .bss region Size determined at link time
* Kernel IDLE thread stack Size determined by CONFIG_IDLETHREAD_STACKSIZE
* Padding for alignment
* User .data region. Size determined at link time.
* User .bss region Size determined at link time.
* Kernel heap. Size determined by CONFIG_MM_KERNEL_HEAPSIZE.
* User heap. Extends to the end of SRAM.
* User .data region Size determined at link time
* User .bss region Size determined at link time
* Kernel heap Size determined by CONFIG_MM_KERNEL_HEAPSIZE
* User heap Extends to the end of SRAM
*
****************************************************************************/
******************************************************************************/
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{
@ -569,7 +575,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
*/
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend +
CONFIG_MM_KERNEL_HEAPSIZE;
size_t usize = SRAM1_END - ubase;
int log2;
@ -613,7 +620,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
#endif
}
/****************************************************************************
/******************************************************************************
* Name: up_allocate_kheap
*
* Description:
@ -621,7 +628,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap.
*
****************************************************************************/
******************************************************************************/
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
@ -631,7 +638,8 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
*/
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend +
CONFIG_MM_KERNEL_HEAPSIZE;
size_t usize = SRAM1_END - ubase;
int log2;
@ -657,14 +665,14 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
}
#endif
/****************************************************************************
/******************************************************************************
* Name: up_addregion
*
* Description:
* Memory may be added in non-contiguous chunks. Additional chunks are
* added by calling this function.
*
****************************************************************************/
******************************************************************************/
#if CONFIG_MM_REGIONS > 1
void up_addregion(void)