HP85 GPIB Disk Emulator  1.0
HP85GPIBDiskEmulator
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rs232.h
Go to the documentation of this file.
1 
13 #ifndef _RS232_H_
14 #define _RS232_H_
15 
16 #include "user_config.h"
17 
18 #define RX_BUF_SIZE 80
19 #define RX_FLOW_WINDOW 20
20 
21 #define RX_OVERFLOW 1
22 
23 #define XON_CHAR 0x11
24 #define XOFF_CHAR 0x13
25 
26 #define XOFF_ENABLE 4
27 #define XOFF_PUT 2
28 #define XOFF_GET 1
29 
30 #ifndef EOF
31 #define EOF (-1)
32 #endif
33 
34 struct _uart
35 {
36  uint8_t rx_head;
37  uint8_t rx_tail;
38  uint8_t rx_flow;
39  int rx_count;
40  uint8_t rx_error;
41  uint8_t rx_buf[RX_BUF_SIZE+1];
42 };
43 
44 #define UARTS 1
45 #define kbhit( uart) uart_rx_count( uart )
46 
47 #define uart_putc(a,c) uart0_putchar(c,NULL)
48 
49 /* rs232.c */
50 void uart_rx_flush ( uint8_t uart );
51 int uart0_getchar ( void *f );
52 int uart0_putchar ( int c , void *f );
53 uint16_t uart_ubr ( uint32_t baud , int *u2x , uint32_t *actual );
54 uint32_t uart_init ( uint8_t uart , uint32_t baud );
55 void uart_rx_interrupt ( uint8_t uart , uint8_t data );
56 int uart_peek_tail ( uint8_t uart );
57 int uart_get_tail ( uint8_t uart );
58 int uart_rx_count ( uint8_t uart );
59 int uart_rx_byte ( uint8_t uart );
60 int uart_getchar ( uint8_t uart );
61 int uart_tx_byte ( int c , uint8_t uart );
62 int uart_putchar ( int c , int uart );
63 int uart_keyhit ( uint8_t uart );
64 int uart_put ( int c );
65 int uart_get ( void );
66 int get_line ( char *buff , int len );
67 #endif // _RS232_H_
uart_rx_interrupt
void uart_rx_interrupt(uint8_t uart, uint8_t data)
UART Receive Interrupt task.
Definition: rs232.c:207
_uart::rx_count
int rx_count
Definition: rs232.h:39
uart_peek_tail
int uart_peek_tail(uint8_t uart)
Return character waiting in ring buffer without removing it.
Definition: rs232.c:227
_uart::rx_flow
uint8_t rx_flow
Definition: rs232.h:38
_uart::rx_buf
uint8_t rx_buf[RX_BUF_SIZE+1]
Definition: rs232.h:41
uart_rx_count
int uart_rx_count(uint8_t uart)
return count of character count waiting in UART ring buffer.
Definition: rs232.c:277
uart_keyhit
int uart_keyhit(uint8_t uart)
Do we have receive characters waiting ?.
Definition: rs232.c:394
uart_put
int uart_put(int c)
Transmit a character on UART 0.
Definition: rs232.c:403
uart_putchar
int uart_putchar(int c, int uart)
Transmit 1 byte on uart.
Definition: rs232.c:376
user_config.h
Master Include for FatFs, RTC, Timers AVR8 - Part of HP85 disk emulator.
uart_getchar
int uart_getchar(uint8_t uart)
Receive character from uart with option CR/LF conversion.
Definition: rs232.c:312
get_line
int get_line(char *buff, int len)
Get a line from UART 0 up to a maximum of len bytes.
Definition: rs232.c:421
uart_init
uint32_t uart_init(uint8_t uart, uint32_t baud)
UART initialization function that works with avr-libc functions.
Definition: rs232.c:117
uart_tx_byte
int uart_tx_byte(int c, uint8_t uart)
Transmit 1 byte on uart.
Definition: rs232.c:347
_uart::rx_tail
uint8_t rx_tail
Definition: rs232.h:37
_uart
Definition: rs232.h:34
uart_get_tail
int uart_get_tail(uint8_t uart)
Return next character from ring buffer.
Definition: rs232.c:249
RX_BUF_SIZE
#define RX_BUF_SIZE
Definition: rs232.h:18
uart_rx_flush
void uart_rx_flush(uint8_t uart)
Flush receive ring buffer for specified uart.
Definition: rs232.c:22
_uart::rx_error
uint8_t rx_error
Definition: rs232.h:40
uart0_putchar
int uart0_putchar(int c, void *f)
uart_rx_byte
int uart_rx_byte(uint8_t uart)
Recive character character from uart.
Definition: rs232.c:299
uart_get
int uart_get(void)
Receive a character from UART 0.
Definition: rs232.c:411
_uart::rx_head
uint8_t rx_head
Definition: rs232.h:36
uart_ubr
uint16_t uart_ubr(uint32_t baud, int *u2x, uint32_t *actual)
UART baud rate caluculation We compute the best values of baud rate register and prescale.
Definition: rs232.c:73
uart0_getchar
int uart0_getchar(void *f)