/*****************************************************************************\ * efs - General purpose Embedded Filesystem library * * --------------------------------------------------------- * * * * Filename : debug.c * * Description : These functions are used for debugging output on different * * environments * * * * 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; version 2 * * of the License. * * * 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. * * * * As a special exception, if other files instantiate templates or * * use macros or inline functions from this file, or you compile this * * file and link it with other works to produce a work based on this file, * * this file does not by itself cause the resulting work to be covered * * by the GNU General Public License. However the source code for this * * file must still be made available in accordance with section (3) of * * the GNU General Public License. * * * * This exception does not invalidate any other reasons why a work based * * on this file might be covered by the GNU General Public License. * * * * (c)2006 Lennart Yseboodt * * (c)2006 Michael De Nil * \*****************************************************************************/ /* COMMENT REGARDING FUNCTION COMMENTS IN THIS FILE * Only the linuxfile debug functions are commented since all functions * perform the same logical task. */ /*****************************************************************************/ #include "debug.h" /*****************************************************************************/ /*****************************************************************************/ #ifdef DEBUG #ifdef HW_ENDPOINT_LINUX_ALL /*****************************************************************************/ /* **************************************************************************** * void debug(const eint8 *format, ...) * Description: This function prints debug output to the screen (target dependant) * and if DO_FUNC_DEBUG is defined also to a localfile. * Return value: void */ void debug(const eint8 *format, ...) { va_list ap; #ifdef DO_FUNC_DEBUG euint8 c; extern FILE* debugfile; extern volatile euint8 tw; #endif va_start(ap, format); vprintf(format,ap); #ifdef DO_FUNC_DEBUG for(c=0;c0)tw--; for(c=0;c=90) debug(PSTR("\n")); } /*****************************************************************************/ void debug_init(void) { unsigned short ubrr; ubrr = ((unsigned short)DEBUG_UBRR); switch(DEBUG_PORT){ case 0: UBRR0H = (euint8) (ubrr>>8); UBRR0L = (euint8) (ubrr); UCSR0B = ( (1<>8); UBRR1L = (euint8) (ubrr); UCSR1B = ( (1<