diff --git a/include/zephyr/multi_heap/shared_multi_heap.h b/include/zephyr/multi_heap/shared_multi_heap.h index 1ab55fc0b6..0d5e66bf29 100644 --- a/include/zephyr/multi_heap/shared_multi_heap.h +++ b/include/zephyr/multi_heap/shared_multi_heap.h @@ -66,7 +66,7 @@ extern "C" { * Enumeration type for some common memory region attributes. * */ -enum smh_reg_attr { +enum shared_multi_heap_attr { /** cacheable */ SMH_REG_ATTR_CACHEABLE, @@ -126,7 +126,7 @@ int shared_multi_heap_pool_init(void); * @retval ptr a valid pointer to heap memory. * @retval err NULL if no memory is available. */ -void *shared_multi_heap_alloc(unsigned int attr, size_t bytes); +void *shared_multi_heap_alloc(enum shared_multi_heap_attr attr, size_t bytes); /** * @brief Allocate aligned memory from the memory shared multi-heap pool @@ -142,7 +142,8 @@ void *shared_multi_heap_alloc(unsigned int attr, size_t bytes); * @retval ptr a valid pointer to heap memory. * @retval err NULL if no memory is available. */ -void *shared_multi_heap_aligned_alloc(unsigned int attr, size_t align, size_t bytes); +void *shared_multi_heap_aligned_alloc(enum shared_multi_heap_attr attr, + size_t align, size_t bytes); /** * @brief Free memory from the shared multi-heap pool diff --git a/lib/os/shared_multi_heap.c b/lib/os/shared_multi_heap.c index e2ae4bf7d7..6aedcdfbd7 100644 --- a/lib/os/shared_multi_heap.c +++ b/lib/os/shared_multi_heap.c @@ -19,10 +19,10 @@ static unsigned int attr_cnt[MAX_SHARED_MULTI_HEAP_ATTR]; static void *smh_choice(struct sys_multi_heap *mheap, void *cfg, size_t align, size_t size) { struct sys_heap *h; - unsigned int attr; + enum shared_multi_heap_attr attr; void *block; - attr = (unsigned int)(long) cfg; + attr = (enum shared_multi_heap_attr)(long) cfg; if (attr >= MAX_SHARED_MULTI_HEAP_ATTR || size == 0) { return NULL; @@ -78,7 +78,7 @@ void shared_multi_heap_free(void *block) sys_multi_heap_free(&shared_multi_heap, block); } -void *shared_multi_heap_alloc(unsigned int attr, size_t bytes) +void *shared_multi_heap_alloc(enum shared_multi_heap_attr attr, size_t bytes) { if (attr >= MAX_SHARED_MULTI_HEAP_ATTR) { return NULL; @@ -87,7 +87,8 @@ void *shared_multi_heap_alloc(unsigned int attr, size_t bytes) return sys_multi_heap_alloc(&shared_multi_heap, (void *)(long) attr, bytes); } -void *shared_multi_heap_aligned_alloc(unsigned int attr, size_t align, size_t bytes) +void *shared_multi_heap_aligned_alloc(enum shared_multi_heap_attr attr, + size_t align, size_t bytes) { if (attr >= MAX_SHARED_MULTI_HEAP_ATTR) { return NULL; diff --git a/tests/kernel/mem_heap/shared_multi_heap/src/main.c b/tests/kernel/mem_heap/shared_multi_heap/src/main.c index c99264430b..d2169f9164 100644 --- a/tests/kernel/mem_heap/shared_multi_heap/src/main.c +++ b/tests/kernel/mem_heap/shared_multi_heap/src/main.c @@ -66,7 +66,7 @@ static struct region_map *get_region_map(void *v_addr) return NULL; } -static inline enum smh_reg_attr mpu_to_reg_attr(int mpu_attr) +static inline enum shared_multi_heap_attr mpu_to_reg_attr(int mpu_attr) { /* * All the memory regions defined in the DT with the MPU property `RAM`