2002-03-28 15:09:10 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2002-08-12 12:44:18 +00:00
|
|
|
* Copyright (C) 2002 by Alan Korr & Nick Robinson
|
2002-03-28 15:09:10 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-03-28 15:09:10 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2008-12-25 01:46:16 +00:00
|
|
|
#include <stdio.h>
|
2002-08-12 12:44:18 +00:00
|
|
|
#include <stdlib.h>
|
2008-12-25 01:46:16 +00:00
|
|
|
#include <stdarg.h>
|
2002-04-21 21:50:00 +00:00
|
|
|
#include "serial.h"
|
2008-12-25 01:46:16 +00:00
|
|
|
|
2007-09-22 02:17:08 +00:00
|
|
|
void dprintf(const char * str, ... )
|
|
|
|
{
|
|
|
|
char dprintfbuff[256];
|
2008-12-25 01:46:16 +00:00
|
|
|
char * ptr;
|
2008-12-25 03:23:22 +00:00
|
|
|
|
2007-09-22 02:17:08 +00:00
|
|
|
va_list ap;
|
|
|
|
va_start(ap, str);
|
|
|
|
|
|
|
|
ptr = dprintfbuff;
|
|
|
|
vsnprintf(ptr,sizeof(dprintfbuff),str,ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
2008-12-25 01:46:16 +00:00
|
|
|
serial_tx((unsigned char *)ptr);
|
2007-09-22 02:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void serial_tx(const unsigned char * buf)
|
|
|
|
{
|
|
|
|
/*Tx*/
|
|
|
|
for(;;) {
|
2008-02-19 14:15:59 +00:00
|
|
|
if(tx_rdy()) {
|
2007-09-22 02:17:08 +00:00
|
|
|
if(*buf == '\0')
|
|
|
|
return;
|
|
|
|
if(*buf == '\n')
|
2008-02-19 14:15:59 +00:00
|
|
|
tx_writec('\r');
|
|
|
|
tx_writec(*buf);
|
2007-09-22 02:17:08 +00:00
|
|
|
buf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|