SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions
log.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <timer.h>
#include <sys-uart.h>
#include "xformat.h"
Include dependency graph for log.h:

Go to the source code of this file.

Macros

#define LOG_LEVEL_MUTE   0
 
#define LOG_LEVEL_ERROR   1
 
#define LOG_LEVEL_WARNING   2
 
#define LOG_LEVEL_INFO   3
 
#define LOG_LEVEL_DEBUG   4
 
#define LOG_LEVEL_TRACE   5
 
#define LOG_LEVEL_BACKTRACE   6
 
#define LOG_LEVEL_DEFAULT   LOG_LEVEL_INFO
 
#define printk_trace(fmt, ...)   ((void) 0)
 
#define printk_debug(fmt, ...)   ((void) 0)
 
#define printk_info(fmt, ...)   printk(LOG_LEVEL_INFO, fmt, ##__VA_ARGS__)
 
#define printk_warning(fmt, ...)   printk(LOG_LEVEL_WARNING, fmt, ##__VA_ARGS__)
 
#define printk_error(fmt, ...)   printk(LOG_LEVEL_ERROR, fmt, ##__VA_ARGS__)
 

Functions

void set_timer_count ()
 Set timer count.
 
void printk (int level, const char *fmt,...)
 Print message to kernel log.
 
void uart_printf (const char *fmt,...)
 Print message via UART.
 
int printf (const char *fmt,...)
 Print message via UART.
 
void dump_hex (uint32_t start_addr, uint32_t count)
 Dumps memory content in hexadecimal format.
 

Macro Definition Documentation

◆ LOG_LEVEL_BACKTRACE

#define LOG_LEVEL_BACKTRACE   6

◆ LOG_LEVEL_DEBUG

#define LOG_LEVEL_DEBUG   4

◆ LOG_LEVEL_DEFAULT

#define LOG_LEVEL_DEFAULT   LOG_LEVEL_INFO

◆ LOG_LEVEL_ERROR

#define LOG_LEVEL_ERROR   1

◆ LOG_LEVEL_INFO

#define LOG_LEVEL_INFO   3

◆ LOG_LEVEL_MUTE

#define LOG_LEVEL_MUTE   0

◆ LOG_LEVEL_TRACE

#define LOG_LEVEL_TRACE   5

◆ LOG_LEVEL_WARNING

#define LOG_LEVEL_WARNING   2

◆ printk_debug

#define printk_debug (   fmt,
  ... 
)    ((void) 0)

◆ printk_error

#define printk_error (   fmt,
  ... 
)    printk(LOG_LEVEL_ERROR, fmt, ##__VA_ARGS__)

◆ printk_info

#define printk_info (   fmt,
  ... 
)    printk(LOG_LEVEL_INFO, fmt, ##__VA_ARGS__)

◆ printk_trace

#define printk_trace (   fmt,
  ... 
)    ((void) 0)

◆ printk_warning

#define printk_warning (   fmt,
  ... 
)    printk(LOG_LEVEL_WARNING, fmt, ##__VA_ARGS__)

Function Documentation

◆ dump_hex()

void dump_hex ( uint32_t  start_addr,
uint32_t  count 
)

Dumps memory content in hexadecimal format.

This function dumps the content of memory starting from the specified address in hexadecimal format. It prints the hexadecimal values of memory contents and ASCII characters corresponding to printable characters.

Parameters
start_addrThe starting address of the memory region to dump.
countThe number of bytes to dump.

◆ printf()

int printf ( const char *  fmt,
  ... 
)

Print message via UART.

This function is used to print formatted message to the terminal via UART serial port.

Parameters
fmtFormat string describing the format of the message to print.
...Variable argument list used to fill placeholders in the format string.
Note
This function is typically used in embedded systems for debugging and outputting system status information.

◆ printk()

void printk ( int  level,
const char *  fmt,
  ... 
)

Print message to kernel log.

This function is used to print the message with specified level to the kernel log.

Parameters
levelInformation level, typically used to specify the importance or type of the message.
fmtFormat string describing the format of the message to print.
...Variable argument list used to fill placeholders in the format string.
Note
This function should be used within the kernel to record important system information or debug messages.

◆ set_timer_count()

void set_timer_count ( )

Set timer count.

This function is used to set the count value of the timer.

Note
Before calling this function, timer-related hardware configuration should be initialized.

Set timer count.

This function calls the frequency detection routine and initializes the timestamp based on the current time in microseconds.

◆ uart_printf()

void uart_printf ( const char *  fmt,
  ... 
)

Print message via UART.

This function is used to print formatted message to the terminal via UART serial port.

Parameters
fmtFormat string describing the format of the message to print.
...Variable argument list used to fill placeholders in the format string.
Note
This function is typically used in embedded systems for debugging and outputting system status information.