|
| 1 | +///////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// File: putchar.c |
| 4 | +// |
| 5 | +// Copyright S. Brennen Ball, 2011 |
| 6 | +// |
| 7 | +// The author provides no guarantees, warranty, or promises, implied or |
| 8 | +// otherwise. By using this software you agree to indemnify the author |
| 9 | +// of any damages incurred by using it. |
| 10 | +// |
| 11 | +///////////////////////////////////////////////////////////////////////////// |
| 12 | + |
| 13 | +///////////////////////////////////////////////////////////////////////////// |
| 14 | +// This library is free software; you can redistribute it and/or |
| 15 | +// modify it under the terms of the GNU Lesser General Public |
| 16 | +// License as published by the Free Software Foundation; either |
| 17 | +// version 2.1 of the License, or (at your option) any later version. |
| 18 | +// |
| 19 | +// This library is distributed in the hope that it will be useful, |
| 20 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | +// Lesser General Public License for more details. |
| 23 | +// |
| 24 | +// You should have received a copy of the GNU Lesser General Public |
| 25 | +// License along with this library; if not, write to the Free Software |
| 26 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 | +///////////////////////////////////////////////////////////////////////////// |
| 28 | + |
| 29 | +#include "uart.h" |
| 30 | +#include "interrupt.h" |
| 31 | + |
| 32 | +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 33 | +// |
| 34 | +// void putchar(char c) |
| 35 | +// |
| 36 | +// Description: |
| 37 | +// Allows use of stdio printf to output to uart |
| 38 | +// |
| 39 | +// Parameters: |
| 40 | +// char c - char to send over the UART |
| 41 | +// |
| 42 | +// Return value: |
| 43 | +// None |
| 44 | +// |
| 45 | +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 46 | +void putchar(char c) |
| 47 | +{ |
| 48 | + interrupt_wait_for_uart_tx(); |
| 49 | + |
| 50 | + interrupt_clear_uart_tx(); |
| 51 | + |
| 52 | + uart_send(c); |
| 53 | +} |
0 commit comments