BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
902aa40
Branches
Tags
master
mips_sys
fw
debug.c
replace email address in headers with blinkenarea address
Stefan Schuermans
commited
902aa40
at 2012-05-21 17:42:50
debug.c
Blame
History
Raw
/* MIPS I system * Copyright 2011-2012 Stefan Schuermans <stefan@blinkenarea.org> * Copyleft GNU public license V2 or later * http://www.gnu.org/copyleft/gpl.html */ #include "debug.h" #include "format.h" #include "macros.h" #include "uart.h" /** * @brief print a character to debug output * @param[in] chr character to print */ void debug_chr(char chr) { uart_tx((unsigned char)chr); } /** * @brief print a string to debug output * @param[in] str string to print */ void debug_str(const char *str) { while (*str) debug_chr(*str++); } /** * @brief print an unsigned integer in decimal to debug output * @param[in] uint unsigned integer value * @param[in] cnt number of digits */ void debug_uint_dec(unsigned int uint, unsigned int cnt) { char buf[11]; if (cnt > count(buf) - 1) cnt = count(buf) - 1; format_uint2dec(uint, cnt, buf); buf[cnt] = 0; debug_str(buf); } /** * @brief print an unsigned integer in hexdecimal to debug output * @param[in] uint unsigned integer value * @param[in] cnt number of digits */ void debug_uint_hex(unsigned int uint, unsigned int cnt) { char buf[9]; if (cnt > count(buf) - 1) cnt = count(buf) - 1; format_uint2hex(uint, cnt, buf); buf[cnt] = 0; debug_str(buf); }