BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
c2b0401
Branches
Tags
master
mips_sys
fw
debug.c
added file headers
Stefan Schuermans
commited
c2b0401
at 2012-04-08 11:54:40
debug.c
Blame
History
Raw
/* MIPS I system * Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info> * 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); }