KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Logging

KOS's Logging API. More...

Modules

 Log Levels
 dbglog severity levels
 

Files

file  dbgio.h
 Debug I/O.
 
file  dbglog.h
 A debugging log.
 
file  fb_console.h
 A simple dbgio interface to draw to the framebuffer.
 

Data Structures

struct  dbgio_handler_t
 Debug I/O Interface. More...
 

Macros

#define DBGIO_MODE_POLLED   0
 Polled I/O mode.
 
#define DBGIO_MODE_IRQ   1
 IRQ-based I/O mode.
 

Functions

int dbgio_dev_select (const char *name)
 Select a new dbgio interface by name.
 
const char * dbgio_dev_get (void)
 Fetch the name of the currently selected dbgio interface.
 
int dbgio_init (void)
 Initialize the dbgio console.
 
int dbgio_set_irq_usage (int mode)
 Set IRQ usage.
 
int dbgio_read (void)
 Read one character from the console.
 
int dbgio_write (int c)
 Write one character to the console.
 
int dbgio_flush (void)
 Flush any queued output.
 
int dbgio_write_buffer (const uint8 *data, int len)
 Write an entire buffer of data to the console.
 
int dbgio_read_buffer (uint8 *data, int len)
 Read an entire buffer of data from the console.
 
int dbgio_write_buffer_xlat (const uint8 *data, int len)
 Write an entire buffer of data to the console (potentially with newline transformations).
 
int dbgio_write_str (const char *str)
 Write a NUL-terminated string to the console.
 
void dbgio_disable (void)
 Disable debug I/O globally.
 
void dbgio_enable (void)
 Enable debug I/O globally.
 
int dbgio_printf (const char *fmt,...) __printflike(1
 Built-in debug I/O printf function.
 
void dbglog (int level, const char *fmt,...) __printflike(2
 Kernel debugging printf. <>
 
void dbglog_set_level (int level)
 Set the debugging log level.
 

Detailed Description

KOS's Logging API.

Macro Definition Documentation

◆ DBGIO_MODE_IRQ

#define DBGIO_MODE_IRQ   1

IRQ-based I/O mode.

See also
dbgio_set_irq_usage()

◆ DBGIO_MODE_POLLED

#define DBGIO_MODE_POLLED   0

Polled I/O mode.

See also
dbgio_set_irq_usage()

Function Documentation

◆ dbgio_dev_get()

const char * dbgio_dev_get ( void  )

Fetch the name of the currently selected dbgio interface.

Returns
The name of the current dbgio interface (or NULL if no device is selected)

◆ dbgio_dev_select()

int dbgio_dev_select ( const char *  name)

Select a new dbgio interface by name.

This function manually selects a new dbgio interface by name. This function will allow you to select a device, even if it is not detected.

Parameters
nameThe dbgio interface to select
Return values
0On success
-1On error
Error Conditions:
ENODEV - The specified device could not be initialized

◆ dbgio_disable()

void dbgio_disable ( void  )

Disable debug I/O globally.

◆ dbgio_enable()

void dbgio_enable ( void  )

Enable debug I/O globally.

◆ dbgio_flush()

int dbgio_flush ( void  )

Flush any queued output.

Return values
0On success
-1On error (errno should be set as appropriate)

◆ dbgio_init()

int dbgio_init ( void  )

Initialize the dbgio console.

This function is called internally, and shouldn't need to be called by any user programs.

Return values
0On success
-1On error
Error Conditions:
ENODEV - No devices could be detected/initialized

◆ dbgio_printf()

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

Built-in debug I/O printf function.

Parameters
fmtA printf() style format string
...Format arguments
Returns
The number of bytes written, or <0 on error (errno should be set as appropriate)

◆ dbgio_read()

int dbgio_read ( void  )

Read one character from the console.

Return values
0On success
-1On error (errno should be set as appropriate)

◆ dbgio_read_buffer()

int dbgio_read_buffer ( uint8 data,
int  len 
)

Read an entire buffer of data from the console.

Parameters
dataThe buffer to read into
lenThe length of the buffer
Returns
Number of characters read on success, or -1 on failure (errno should be set as appropriate)

◆ dbgio_set_irq_usage()

int dbgio_set_irq_usage ( int  mode)

Set IRQ usage.

The dbgio system defaults to polled usage. Some devices may not support IRQ mode at all.

Parameters
modeThe mode to use
Return values
0On success
-1On error (errno should be set as appropriate)

◆ dbgio_write()

int dbgio_write ( int  c)

Write one character to the console.

Note
Interfaces may require a call to flush() before the output is actually flushed to the console.
Parameters
cThe character to write
Return values
1On success (number of characters written)
-1On error (errno should be set as appropriate)

◆ dbgio_write_buffer()

int dbgio_write_buffer ( const uint8 data,
int  len 
)

Write an entire buffer of data to the console.

Parameters
dataThe buffer to write
lenThe length of the buffer
Returns
Number of characters written on success, or -1 on failure (errno should be set as appropriate)

◆ dbgio_write_buffer_xlat()

int dbgio_write_buffer_xlat ( const uint8 data,
int  len 
)

Write an entire buffer of data to the console (potentially with newline transformations).

Parameters
dataThe buffer to write
lenThe length of the buffer
Returns
Number of characters written on success, or -1 on failure (errno should be set as appropriate)

◆ dbgio_write_str()

int dbgio_write_str ( const char *  str)

Write a NUL-terminated string to the console.

Parameters
strThe string to write
Returns
Number of characters written on success, or -1 on failure (errno should be set as appropriate)

◆ dbglog()

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

Kernel debugging printf. <>

This function is similar to printf(), but filters its output through a log level check before being printed. This way, you can set the level of debug info you want to see (or want your users to see).

Parameters
levelThe level of importance of this message.
fmtMessage format string.
...Format arguments
See also
Log Levels

◆ dbglog_set_level()

void dbglog_set_level ( int  level)

Set the debugging log level.

This function sets the level for which dbglog() will ignore messages for if the message has a higher level.

Parameters
levelThe level to stop paying attention after.
See also
Log Levels