#include <stdint.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <hpm_l1c_drv.h>#include <hpm_interrupt.h>#include <hpm_sysctl_drv.h>#include <hpm_clock_drv.h>#include "hpm_log.h"Data Structures | |
| struct | hpm_log_fifo |
| struct | hpm_log_engine |
| struct | hpm_log |
Typedefs | |
| typedef struct hpm_log | hpm_log_t |
| typedef struct hpm_log_fifo | hpm_log_fifo_t |
Functions | |
| static void | hpm_log_fifo_init (hpm_log_fifo_t *fifo, char *buf, uint32_t size) |
| static uint32_t | hpm_log_fifo_get_len (hpm_log_fifo_t *fifo) |
| static void | hpm_log_fifo_push (hpm_log_fifo_t *fifo, char *buf, uint32_t len) |
| static uint32_t | hpm_log_fifo_pop (hpm_log_fifo_t *fifo, char *buf, uint32_t len) |
| hpm_log_engine_t * | hpm_log_engine_create (hpm_log_engine_config_t *cfg) |
| Create a log engine. More... | |
| int | hpm_log_engine_destroy (hpm_log_engine_t *engine) |
| Destroy a log engine. More... | |
| void | hpm_log_engine_enable (hpm_log_engine_t *engine) |
| Enable a log engine. More... | |
| void | hpm_log_engine_disable (hpm_log_engine_t *engine) |
| Disable a log engine. More... | |
| static void | hpm_log_engine_transfer_start (hpm_log_engine_t *engine) |
| void | hpm_log_engine_transfer_finish (hpm_log_engine_t *engine) |
| Indicate that the transfer of a log message is finished. More... | |
| void | hpm_log_engine_dump (hpm_log_engine_t *engine) |
| Dump all log messages in the FIFO buffer. More... | |
| static void | hpm_log_transfer_start_all (hpm_log_t *ctx) |
| static void | hpm_log_fifo_push_all (hpm_log_t *ctx, char *message, uint32_t messge_len) |
| void | hpm_log_write (int level, const char *func, const int line, const char *fmt,...) |
| Write a log message with a specified level. More... | |
| void | hpm_log_printf (const char *fmt,...) |
| Print a formatted log message. More... | |
| static uint64_t | hpm_log_cpu_get_us (void) |
| static long | hpm_log_lock (void) |
| static void | hpm_log_unlock (long restore) |
| void | hpm_log_init (hpm_log_config_t *cfg) |
| Initialize the log module. More... | |
Variables | |
| static hpm_log_t | hpm_log_ctx |
| typedef struct hpm_log_fifo hpm_log_fifo_t |
|
static |
| hpm_log_engine_t* hpm_log_engine_create | ( | hpm_log_engine_config_t * | cfg | ) |
Create a log engine.
This function creates a new log engine with the specified configuration.
| cfg | Pointer to the log engine configuration structure. |
| int hpm_log_engine_destroy | ( | hpm_log_engine_t * | engine | ) |
Destroy a log engine.
This function destroys the specified log engine and releases its resources.
| engine | Pointer to the log engine to be destroyed. |
| void hpm_log_engine_disable | ( | hpm_log_engine_t * | engine | ) |
Disable a log engine.
This function disables the specified log engine, preventing it from processing log messages.
| engine | Pointer to the log engine to be disabled. |
| void hpm_log_engine_dump | ( | hpm_log_engine_t * | engine | ) |
Dump all log messages in the FIFO buffer.
This function transfers all log messages currently in the FIFO buffer of the specified log engine.
| engine | Pointer to the log engine whose FIFO buffer should be dumped. |
| void hpm_log_engine_enable | ( | hpm_log_engine_t * | engine | ) |
Enable a log engine.
This function enables the specified log engine, allowing it to start processing log messages.
| engine | Pointer to the log engine to be enabled. |
| void hpm_log_engine_transfer_finish | ( | hpm_log_engine_t * | engine | ) |
Indicate that the transfer of a log message is finished.
This function is called to indicate that the transfer of a log message has finished. It may trigger the transfer of the next message in the FIFO buffer.
| engine | Pointer to the log engine for which the transfer has finished. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void hpm_log_init | ( | hpm_log_config_t * | cfg | ) |
Initialize the log module.
This function initializes the log module with the specified configuration.
| cfg | Pointer to the log module configuration structure. if NULL, the default is used. |
|
static |
| void hpm_log_printf | ( | const char * | fmt, |
| ... | |||
| ) |
Print a formatted log message.
This function prints a formatted log message using the specified format string and arguments.
| fmt | Format string for the log message. |
| ... | Variable arguments corresponding to the format string. |
|
static |
|
static |
| void hpm_log_write | ( | int | level, |
| const char * | func, | ||
| const int | line, | ||
| const char * | fmt, | ||
| ... | |||
| ) |
Write a log message with a specified level.
This function writes a log message with the specified log level, function name, line number, and format string and arguments.
| level | Log level of the message. |
| func | Name of the function where the log message is generated. |
| line | Line number in the source file where the log message is generated. |
| fmt | Format string for the log message. |
| ... | Variable arguments corresponding to the format string. |
|
static |