next up previous contents
Next: IRQ/Context Management Up: Hardware Abstraction Layer: Portable Previous: Misc Program Control Calls   Contents

Subsections

Bootstrap Debug Input/Output

Every architecture supported by KOS supports the concept of a debug I/O console. Sometimes this may not be connected to anything (especially in the really embedded ports like GBA) but this is where all debug and printf output goes by default, and this is where any pieces (such as DC's libconio) will grab their key input if configured to do so from the dbgio channel.

dbgio_printk_func dbgio_set_printk(dbgio_printk_func func)

Set a function to capture all debug output that comes through dbgio_printf, and return the old function. This is used by, e.g., dc-tool. The type for the function is:

typedef void (* dbgio_printk_func)(const char *);

void dbgio_set_parameters(int baud, int fifo)

Set serial parameters; this is not as platform independent as I want it to be, but it should be generic enough to be useful. The baud rate will be set to baud and if fifo is non-zero, the serial FIFO will be enabled.

void dbgio_write(int c)

Write one char to the debug port. You must call dbgio_flush() to actually ensure that the output was sent.

void dbgio_flush()

Flush all buffered bytes out of the port buffer, if any.

void dbgio_write_buffer(const uint8 * data, int len)

Send an entire buffer of data. This is just a shortcut for sending each byte of data with dbgio_write.

void dbgio_read_buffer(uint8 * data, int len)

Read an entire block of data. This is just a shortcut for reading each byte of data with dbgio_read. Note that this function will block until it has len bytes of data.

void dbgio_write_str(const char * str)

Send a C string (null-terminated).

int dbgio_read()

Read one char from the debug port (-1 if nothing to read).

void dbgio_disable()

Disable debug I/O globally; all debug output will be discarded and debug input will always return failure. This can be used as a quick way to disable all of your debug output before burning a final copy of your game/demo, etc.

void dbgio_enable()

Enable debug I/O globally (after calling dbgio_disable).

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

Works like dbgio_write_str, but provides formatting capabilities. There is a limit to the number of characters that can be in the resulting string, so don't pass arbitrarily long strings to this function.


next up previous contents
Next: IRQ/Context Management Up: Hardware Abstraction Layer: Portable Previous: Misc Program Control Calls   Contents
Dan Potter 2002-07-29