Imported Upstream version 2.9.0
[debian/cc1111] / device / lib / pic16 / libc / stdio / strmusart.c
1 /*-----------------------------------------------------------------
2     strmusart.c - usart stream putchar
3
4     Written for pic16 port, by Vangelis Rokas, 2004 (vrokas@otenet.gr)
5
6     Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
7
8     This library is free software; you can redistribute it and/or modify it
9     under the terms of the GNU Library General Public License as published by the
10     Free Software Foundation; either version 2, or (at your option) any
11     later version.
12
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Library General Public License for more details.
17
18     You should have received a copy of the GNU Library General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22     In other words, you are welcome to use, share and improve this program.
23     You are forbidden to forbid anyone else to use, share and improve
24     what you give them.   Help stamp out software-hoarding!
25
26    As a special exception, if you link this library with other files,
27    some of which are compiled with SDCC, to produce an executable,
28    this library does not by itself cause the resulting executable
29    to be covered by the GNU General Public License.
30    This exception does not however invalidate any other reasons why
31    the executable file might be covered by the GNU General Public License.
32 -------------------------------------------------------------------------*/
33
34 extern WREG;
35 extern TXREG;
36 extern TXSTA;
37
38 /* note that USART should already been initialized */
39 void
40 __stream_usart_putchar (char c) __wparam __naked
41 {
42   (void)c;
43   __asm
44 @1:
45     BTFSS       _TXSTA, 1
46     BRA         @1
47     MOVWF       _TXREG
48     RETURN
49   __endasm;
50 }