avr-crypto-lib/test_src/debug.c

65 lines
1.4 KiB
C
Raw Permalink Normal View History

2008-05-26 19:13:21 +00:00
/* debug.c */
/*
2009-01-30 23:00:04 +00:00
This file is part of the AVR-Crypto-Lib.
2015-02-06 02:43:31 +00:00
Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
2008-05-26 19:13:21 +00:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************
*
*
*
****************************/
#include "config.h"
#if DEBUG_METHOD == uart
#include "uart.h"
#else
#error "Your DEBUG methode is not suported!"
#endif
#ifdef DEBUG_METHOD
void debug_init(void){
#if DEBUG_METHOD==uart
2009-07-29 09:49:57 +00:00
uart0_init();
#else
#error "Your DEBUG methode is not suported!"
#endif
}
void debug_char(char c){
static char initialised = 0;
if (!initialised){
2009-07-29 09:49:57 +00:00
uart0_init();
initialised=1;
}
2009-07-29 09:49:57 +00:00
uart0_putc(c);
}
void debug_str(char *s){
while (*s)
debug_char(*s++);
}
void debug_byte(char b){
char table[] = "0123456789ABCDEF";
debug_char(table[(b>>4) & 0xf]);
debug_char(table[b&0xf]);
}
#endif //DEBUG