Last change
on this file since 8 was
1,
checked in by bouyer, 8 years ago
|
Initial commit of soc-conso files
|
File size:
690 bytes
|
Line | |
---|
1 | |
---|
2 | char getchar(void); |
---|
3 | |
---|
4 | /* #define UART_BUFSIZE 16 */ |
---|
5 | /* #define UART_BUFSIZE_MASK 0x0f */ |
---|
6 | #define UART_BUFSIZE 128 |
---|
7 | #define UART_BUFSIZE_MASK 0x7f |
---|
8 | |
---|
9 | extern char uart_txbuf[UART_BUFSIZE]; |
---|
10 | extern unsigned char uart_txbuf_prod; |
---|
11 | extern volatile unsigned char uart_txbuf_cons; |
---|
12 | |
---|
13 | #define USART_INIT { \ |
---|
14 | uart_txbuf_prod = uart_txbuf_cons = 0; \ |
---|
15 | } |
---|
16 | |
---|
17 | #define USART_INTR {\ |
---|
18 | if (PIE1bits.TX1IE && PIR1bits.TX1IF) { \ |
---|
19 | if (uart_txbuf_prod == uart_txbuf_cons) { \ |
---|
20 | PIE1bits.TX1IE = 0; /* buffer empty */ \ |
---|
21 | } else { \ |
---|
22 | /* Place char in TXREG - this starts transmition */ \ |
---|
23 | TXREG1 = uart_txbuf[uart_txbuf_cons]; \ |
---|
24 | uart_txbuf_cons = (uart_txbuf_cons + 1) & UART_BUFSIZE_MASK;\ |
---|
25 | } \ |
---|
26 | } \ |
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.