zephyr/lib/gui/lvgl/lvgl_mem_kernel.c
Andy Ross fcd392f6ce kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the
z_mem_pool wrapper that provided compatibility with the older mempool
implementation.

Almost all of this is straightforward swapping of one alloc/free call
for another.  In a few cases where code was holding onto an old-style
"mem_block" a local compatibility struct with a single field has been
swapped in to keep the invasiveness of the changes down.

Note that not all the relevant changes in this patch have in-tree test
coverage, though I validated that it all builds.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00

22 lines
438 B
C

/*
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "lvgl_mem.h"
#include <zephyr.h>
#include <init.h>
K_HEAP_DEFINE(lvgl_mem_pool, CONFIG_LVGL_MEM_POOL_MAX_SIZE *
CONFIG_LVGL_MEM_POOL_NUMBER_BLOCKS);
void *lvgl_malloc(size_t size)
{
return k_heap_alloc(&lvgl_mem_pool, size, K_NO_WAIT);
}
void lvgl_free(void *ptr)
{
k_heap_free(&lvgl_mem_pool, ptr);
}