diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
| commit | 64bd9053a25297f7a442ca831c7da5b44bd33f84 (patch) | |
| tree | a90c6cad25a12028302ab1a5334510fba0229bae /lib/lvgl/src/stdlib/clib | |
| parent | 611176ed667c4ed7ee9f609e958f9404f4aee91d (diff) | |
| download | tangara-fw-64bd9053a25297f7a442ca831c7da5b44bd33f84.tar.gz | |
Update LVGL to v9.1.0
Diffstat (limited to 'lib/lvgl/src/stdlib/clib')
| -rw-r--r-- | lib/lvgl/src/stdlib/clib/lv_mem_core_clib.c | 94 | ||||
| -rw-r--r-- | lib/lvgl/src/stdlib/clib/lv_sprintf_clib.c | 58 | ||||
| -rw-r--r-- | lib/lvgl/src/stdlib/clib/lv_string_clib.c | 93 |
3 files changed, 245 insertions, 0 deletions
diff --git a/lib/lvgl/src/stdlib/clib/lv_mem_core_clib.c b/lib/lvgl/src/stdlib/clib/lv_mem_core_clib.c new file mode 100644 index 00000000..9cdddf4d --- /dev/null +++ b/lib/lvgl/src/stdlib/clib/lv_mem_core_clib.c @@ -0,0 +1,94 @@ +/** + * @file lv_malloc_core.c + */ + +/********************* + * INCLUDES + *********************/ +#include "../lv_mem.h" +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_CLIB +#include "../../stdlib/lv_mem.h" +#include <stdlib.h> + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_mem_init(void) +{ + return; /*Nothing to init*/ +} + +void lv_mem_deinit(void) +{ + return; /*Nothing to deinit*/ + +} + +lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes) +{ + /*Not supported*/ + LV_UNUSED(mem); + LV_UNUSED(bytes); + return NULL; +} + +void lv_mem_remove_pool(lv_mem_pool_t pool) +{ + /*Not supported*/ + LV_UNUSED(pool); + return; +} + +void * lv_malloc_core(size_t size) +{ + return malloc(size); +} + +void * lv_realloc_core(void * p, size_t new_size) +{ + return realloc(p, new_size); +} + +void lv_free_core(void * p) +{ + free(p); +} + +void lv_mem_monitor_core(lv_mem_monitor_t * mon_p) +{ + /*Not supported*/ + LV_UNUSED(mon_p); + return; +} + +lv_result_t lv_mem_test_core(void) +{ + /*Not supported*/ + return LV_RESULT_OK; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +#endif /*LV_STDLIB_CLIB*/ diff --git a/lib/lvgl/src/stdlib/clib/lv_sprintf_clib.c b/lib/lvgl/src/stdlib/clib/lv_sprintf_clib.c new file mode 100644 index 00000000..4f4fb9c7 --- /dev/null +++ b/lib/lvgl/src/stdlib/clib/lv_sprintf_clib.c @@ -0,0 +1,58 @@ + +/** + * @file lv_templ.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "../../lv_conf_internal.h" +#if LV_USE_STDLIB_SPRINTF == LV_STDLIB_CLIB +#include <stdio.h> +#include <stdarg.h> +#include "../lv_sprintf.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +int lv_snprintf(char * buffer, size_t count, const char * format, ...) +{ + va_list va; + va_start(va, format); + const int ret = vsnprintf(buffer, count, format, va); + va_end(va); + return ret; +} + +int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va) +{ + return vsnprintf(buffer, count, format, va); +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +#endif diff --git a/lib/lvgl/src/stdlib/clib/lv_string_clib.c b/lib/lvgl/src/stdlib/clib/lv_string_clib.c new file mode 100644 index 00000000..359b2e03 --- /dev/null +++ b/lib/lvgl/src/stdlib/clib/lv_string_clib.c @@ -0,0 +1,93 @@ +/** + * @file lv_string.c + */ + +/********************* + * INCLUDES + *********************/ +#include "../../lv_conf_internal.h" +#if LV_USE_STDLIB_STRING == LV_STDLIB_CLIB +#include "../lv_string.h" +#include "../lv_mem.h" /*Need lv_malloc*/ +#include <string.h> + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void * LV_ATTRIBUTE_FAST_MEM lv_memcpy(void * dst, const void * src, size_t len) +{ + return memcpy(dst, src, len); +} + +void LV_ATTRIBUTE_FAST_MEM lv_memset(void * dst, uint8_t v, size_t len) +{ + memset(dst, v, len); +} + +void * LV_ATTRIBUTE_FAST_MEM lv_memmove(void * dst, const void * src, size_t len) +{ + return memmove(dst, src, len); +} + +size_t lv_strlen(const char * str) +{ + return strlen(str); +} + +char * lv_strncpy(char * dst, const char * src, size_t dest_size) +{ + if(dest_size > 0) { + dst[0] = '\0'; + strncat(dst, src, dest_size - 1); + } + + return dst; +} + +char * lv_strcpy(char * dst, const char * src) +{ + return strcpy(dst, src); +} + +int32_t lv_strcmp(const char * s1, const char * s2) +{ + return strcmp(s1, s2); +} + +char * lv_strdup(const char * src) +{ + /*strdup uses malloc, so use the lv_malloc when LV_USE_STDLIB_MALLOC is not LV_STDLIB_CLIB */ + size_t len = lv_strlen(src) + 1; + char * dst = lv_malloc(len); + if(dst == NULL) return NULL; + + lv_memcpy(dst, src, len); /*do memcpy is faster than strncpy when length is known*/ + return dst; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +#endif /*LV_STDLIB_CLIB*/ |
