3 * USART communications module library header
5 * written for SDCC/pic16 port by Vangelis Rokas, 2005 <vrokas AT otenet.gr>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #define RAM_SCLS __data
33 /* configuration bit masks for open function */
34 #define USART_TX_INT_ON 0xff
35 #define USART_TX_INT_OFF 0x7f
36 #define USART_RX_INT_ON 0xff
37 #define USART_RX_INT_OFF 0xbf
38 #define USART_BRGH_HIGH 0xff
39 #define USART_BRGH_LOW 0xef
40 #define USART_CONT_RX 0xff
41 #define USART_SINGLE_RX 0xf7
42 #define USART_SYNC_MASTER 0xff
43 #define USART_SYNC_SLAVE 0xfb
44 #define USART_NINE_BIT 0xff
45 #define USART_EIGHT_BIT 0xfd
46 #define USART_SYNCH_MODE 0xff
47 #define USART_ASYNCH_MODE 0xfe
57 unsigned FRAME_ERROR:1;
58 unsigned OVERRUN_ERROR:1;
63 void usart_open(unsigned char config, unsigned int spbrg) __wparam;
64 void usart_close(void);
66 unsigned char usart_busy(void) __naked;
67 unsigned char usart_drdy(void) __naked;
69 unsigned char usart_getc(void);
70 void usart_gets(RAM_SCLS char *buffer, unsigned char len);
72 void usart_putc(unsigned char data) __wparam __naked;
73 void usart_puts(char *data);
76 void usart_baud(unsigned char baudconfig) __wparam;