|
esp32-audio-player 0.1.0
Audio player engine for ESP32
|
Base definitions shared by every core module: error codes, memory, logging, locks. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | core_allocator_t |
| Memory. More... | |
| struct | core_lock_ops_t |
| Locks. More... | |
Macros | |
| #define | CORE_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| #define | CORE_MIN(a, b) ((a) < (b) ? (a) : (b)) |
| #define | CORE_MAX(a, b) ((a) > (b) ? (a) : (b)) |
| #define | CORE_CLAMP(v, lo, hi) ((v) < (lo) ? (lo) : ((v) > (hi) ? (hi) : (v))) |
| #define | CORE_PATH_MAX 256 |
| Maximum path length used by the core (bytes, UTF-8, including terminator). | |
| #define | CORE_LOGE(tag, ...) core_log(CORE_LOG_ERROR, tag, __VA_ARGS__) |
| #define | CORE_LOGW(tag, ...) core_log(CORE_LOG_WARN, tag, __VA_ARGS__) |
| #define | CORE_LOGI(tag, ...) core_log(CORE_LOG_INFO, tag, __VA_ARGS__) |
| #define | CORE_LOGD(tag, ...) core_log(CORE_LOG_DEBUG, tag, __VA_ARGS__) |
Typedefs | |
| typedef void(* | core_log_sink_t) (core_log_level_t level, const char *tag, const char *msg) |
| typedef struct core_mutex | core_mutex_t |
| typedef uint32_t(* | core_clock_fn_t) (void) |
| Time. Monotonic milliseconds, installed by the platform (default: clock()). | |
Enumerations | |
| enum | core_err_t { CORE_OK = 0 , CORE_ERR = -1 , CORE_EOF = -2 , CORE_ENOMEM = -3 , CORE_EINVAL = -4 , CORE_EIO = -5 , CORE_EUNSUPPORTED = -6 , CORE_EAGAIN = -7 , CORE_ENOTFOUND = -8 , CORE_ECORRUPT = -9 } |
| Errors. Functions return 0 (CORE_OK) or a negative code. More... | |
| enum | core_log_level_t { CORE_LOG_ERROR = 1 , CORE_LOG_WARN , CORE_LOG_INFO , CORE_LOG_DEBUG } |
| Logging. The platform installs a sink; default prints to stderr. More... | |
Functions | |
| const char * | core_err_name (int err) |
| void | core_set_allocator (const core_allocator_t *a) |
| NULL restores stdlib defaults. | |
| void * | core_malloc (size_t size) |
| large (PSRAM on device) | |
| void * | core_calloc (size_t n, size_t size) |
| large, zeroed | |
| void * | core_malloc_fast (size_t size) |
| fast (internal RAM on device) | |
| void * | core_realloc (void *ptr, size_t size) |
| large | |
| void | core_free (void *ptr) |
| char * | core_strdup (const char *s) |
| void | core_set_log_sink (core_log_sink_t sink, core_log_level_t max_level) |
| void | core_log (core_log_level_t level, const char *tag, const char *fmt,...) |
| void | core_set_lock_ops (const core_lock_ops_t *ops) |
| NULL restores no-op. | |
| core_mutex_t * | core_mutex_create (void) |
| void | core_mutex_lock (core_mutex_t *m) |
| void | core_mutex_unlock (core_mutex_t *m) |
| void | core_mutex_destroy (core_mutex_t *m) |
| void | core_set_clock (core_clock_fn_t fn) |
| uint32_t | core_now_ms (void) |
| size_t | core_strlcpy (char *dst, const char *src, size_t size) |
| Small string helpers (UTF-8 safe where noted). | |
| size_t | core_strlcat (char *dst, const char *src, size_t size) |
| bool | core_str_ends_with_ci (const char *s, const char *suffix) |
| ASCII case-insensitive. | |
| const char * | core_path_ext (const char *path) |
| pointer after last '.', "" if none | |
| const char * | core_path_basename (const char *path) |
| void | core_path_dirname (const char *path, char *out, size_t out_size) |
| int | core_path_join (char *out, size_t out_size, const char *dir, const char *name) |
Base definitions shared by every core module: error codes, memory, logging, locks.
The core is portable C17 without ESP-IDF headers: it builds for ESP32 and for the host PC.
| #define CORE_ARRAY_SIZE | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
| #define CORE_CLAMP | ( | v, | |
| lo, | |||
| hi | |||
| ) | ((v) < (lo) ? (lo) : ((v) > (hi) ? (hi) : (v))) |
| #define CORE_LOGD | ( | tag, | |
| ... | |||
| ) | core_log(CORE_LOG_DEBUG, tag, __VA_ARGS__) |
| #define CORE_LOGE | ( | tag, | |
| ... | |||
| ) | core_log(CORE_LOG_ERROR, tag, __VA_ARGS__) |
| #define CORE_LOGI | ( | tag, | |
| ... | |||
| ) | core_log(CORE_LOG_INFO, tag, __VA_ARGS__) |
| #define CORE_LOGW | ( | tag, | |
| ... | |||
| ) | core_log(CORE_LOG_WARN, tag, __VA_ARGS__) |
| #define CORE_MAX | ( | a, | |
| b | |||
| ) | ((a) > (b) ? (a) : (b)) |
| #define CORE_MIN | ( | a, | |
| b | |||
| ) | ((a) < (b) ? (a) : (b)) |
| #define CORE_PATH_MAX 256 |
Maximum path length used by the core (bytes, UTF-8, including terminator).
| typedef uint32_t(* core_clock_fn_t) (void) |
Time. Monotonic milliseconds, installed by the platform (default: clock()).
| typedef void(* core_log_sink_t) (core_log_level_t level, const char *tag, const char *msg) |
| typedef struct core_mutex core_mutex_t |
| enum core_err_t |
| enum core_log_level_t |
| void * core_calloc | ( | size_t | n, |
| size_t | size | ||
| ) |
large, zeroed
| const char * core_err_name | ( | int | err | ) |
| void core_free | ( | void * | ptr | ) |
| void core_log | ( | core_log_level_t | level, |
| const char * | tag, | ||
| const char * | fmt, | ||
| ... | |||
| ) |
| void * core_malloc | ( | size_t | size | ) |
large (PSRAM on device)
| void * core_malloc_fast | ( | size_t | size | ) |
fast (internal RAM on device)
| core_mutex_t * core_mutex_create | ( | void | ) |
| void core_mutex_destroy | ( | core_mutex_t * | m | ) |
| void core_mutex_lock | ( | core_mutex_t * | m | ) |
| void core_mutex_unlock | ( | core_mutex_t * | m | ) |
| uint32_t core_now_ms | ( | void | ) |
| const char * core_path_basename | ( | const char * | path | ) |
| void core_path_dirname | ( | const char * | path, |
| char * | out, | ||
| size_t | out_size | ||
| ) |
| const char * core_path_ext | ( | const char * | path | ) |
pointer after last '.', "" if none
| int core_path_join | ( | char * | out, |
| size_t | out_size, | ||
| const char * | dir, | ||
| const char * | name | ||
| ) |
| void * core_realloc | ( | void * | ptr, |
| size_t | size | ||
| ) |
large
| void core_set_allocator | ( | const core_allocator_t * | a | ) |
NULL restores stdlib defaults.
| void core_set_clock | ( | core_clock_fn_t | fn | ) |
| void core_set_lock_ops | ( | const core_lock_ops_t * | ops | ) |
NULL restores no-op.
| void core_set_log_sink | ( | core_log_sink_t | sink, |
| core_log_level_t | max_level | ||
| ) |
| bool core_str_ends_with_ci | ( | const char * | s, |
| const char * | suffix | ||
| ) |
ASCII case-insensitive.
| char * core_strdup | ( | const char * | s | ) |
| size_t core_strlcat | ( | char * | dst, |
| const char * | src, | ||
| size_t | size | ||
| ) |
| size_t core_strlcpy | ( | char * | dst, |
| const char * | src, | ||
| size_t | size | ||
| ) |
Small string helpers (UTF-8 safe where noted).
always terminates