shared_multi_heap: Use proper enum instead of int
We have an enum for the memory attr, use that instead of a generic unsigned int. Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
parent
fbc6a91a5a
commit
b7e252c2db
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`
|
||||
|
|
Loading…
Reference in a new issue