Skip to content

Commit

Permalink
lib: mem_block: move to own folder
Browse files Browse the repository at this point in the history
Move mem_block into own folder and seperate from lib/os and heap
configuration.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Dec 13, 2023
1 parent 740d0c3 commit d4c881d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 50 deletions.
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif()
add_subdirectory_ifdef(CONFIG_CPP cpp)
add_subdirectory(hash)
add_subdirectory(heap)
add_subdirectory(mem_blocks)
add_subdirectory(os)
add_subdirectory_ifdef(CONFIG_SMF smf)
add_subdirectory_ifdef(CONFIG_OPENAMP open-amp)
Expand Down
2 changes: 2 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ source "lib/hash/Kconfig"

source "lib/heap/Kconfig"

source "lib/mem_blocks/Kconfig"

source "lib/os/Kconfig"

source "lib/posix/Kconfig"
Expand Down
47 changes: 0 additions & 47 deletions lib/heap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -132,51 +132,4 @@ config SHARED_MULTI_HEAP
different capabilities / attributes (cacheable, non-cacheable,
etc...) defined in the DT.

config SYS_MEM_BLOCKS
bool "(Yet Another) Memory Blocks Allocator"
help
This enables support for memory block allocator where:
() All memory blocks have a single fixed size.
() Multiple blocks can be allocated or freed at the same time.
() A group of blocks allocated together may not be contiguous.
This is useful for operations such as scatter-gather DMA
transfers.
() Bookkeeping of allocated blocks is done outside of
the associated buffer (unlike memory slab). This allows
the buffer to reside in memory regions where these can be
powered down to conserve energy.

config SYS_MEM_BLOCKS_LISTENER
bool "Memory Blocks Allocator event notifications"
depends on SYS_MEM_BLOCKS
select HEAP_LISTENER
help
This allows application to listen for memory blocks allocator
events, such as memory allocation and de-allocation.

config SYS_MEM_BLOCKS_RUNTIME_STATS
bool "Memory blocks runtime statistics"
depends on SYS_MEM_BLOCKS
help
This option enables the tracking and reporting of the memory
blocks statistics related to the current and maximum number
of allocations in a given memory block.

config OBJ_CORE_SYS_MEM_BLOCKS
bool "Kernel object for memory blocks"
depends on SYS_MEM_BLOCKS && OBJ_CORE
default y if SYS_MEM_BLOCKS && OBJ_CORE
help
This option allows object cores to be integrated into memory block
objects.

config OBJ_CORE_STATS_SYS_MEM_BLOCKS
bool "Object core statistics for memory blocks"
depends on SYS_MEM_BLOCKS && OBJ_CORE_STATS
default y if SYS_MEM_BLOCKS && OBJ_CORE_STATS
select SYS_MEM_BLOCKS_RUNTIME_STATS
help
This option integrates the object core statistics framework into
the memory blocks.

endmenu
3 changes: 3 additions & 0 deletions lib/mem_blocks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_sources_ifdef(CONFIG_SYS_MEM_BLOCKS mem_blocks.c)
54 changes: 54 additions & 0 deletions lib/mem_blocks/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2021,2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

menu "Memory Blocks"

config SYS_MEM_BLOCKS
bool "(Yet Another) Memory Blocks Allocator"
help
This enables support for memory block allocator where:
() All memory blocks have a single fixed size.
() Multiple blocks can be allocated or freed at the same time.
() A group of blocks allocated together may not be contiguous.
This is useful for operations such as scatter-gather DMA
transfers.
() Bookkeeping of allocated blocks is done outside of
the associated buffer (unlike memory slab). This allows
the buffer to reside in memory regions where these can be
powered down to conserve energy.

config SYS_MEM_BLOCKS_LISTENER
bool "Memory Blocks Allocator event notifications"
depends on SYS_MEM_BLOCKS
select HEAP_LISTENER
help
This allows application to listen for memory blocks allocator
events, such as memory allocation and de-allocation.

config SYS_MEM_BLOCKS_RUNTIME_STATS
bool "Memory blocks runtime statistics"
depends on SYS_MEM_BLOCKS
help
This option enables the tracking and reporting of the memory
blocks statistics related to the current and maximum number
of allocations in a given memory block.

config OBJ_CORE_SYS_MEM_BLOCKS
bool "Kernel object for memory blocks"
depends on SYS_MEM_BLOCKS && OBJ_CORE
default y if SYS_MEM_BLOCKS && OBJ_CORE
help
This option allows object cores to be integrated into memory block
objects.

config OBJ_CORE_STATS_SYS_MEM_BLOCKS
bool "Object core statistics for memory blocks"
depends on SYS_MEM_BLOCKS && OBJ_CORE_STATS
default y if SYS_MEM_BLOCKS && OBJ_CORE_STATS
select SYS_MEM_BLOCKS_RUNTIME_STATS
help
This option integrates the object core statistics framework into
the memory blocks.

endmenu
File renamed without changes.
2 changes: 0 additions & 2 deletions lib/os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ zephyr_sources_ifdef(CONFIG_REBOOT reboot.c)

zephyr_sources_ifdef(CONFIG_UTF8 utf8.c)

zephyr_sources_ifdef(CONFIG_SYS_MEM_BLOCKS mem_blocks.c)

zephyr_sources_ifdef(CONFIG_WINSTREAM winstream.c)

zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)
Expand Down
1 change: 0 additions & 1 deletion lib/os/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,4 @@ config UTF8

rsource "Kconfig.cbprintf"


endmenu

0 comments on commit d4c881d

Please sign in to comment.