/*
* The method of "connecting" the the UART from external code is to use 4 IRQS.
- * The easy one is UART->YOU, where you will be called with the byte everytime
+ * The easy one is UART->YOU, where you will be called with the byte every time
* the AVR firmware sends one. Do whatever you like with it.
*
* The slightly more tricky one is the INPUT part. Since the AVR is quite a bit
* slower than your code most likely, there is a way for the AVR UART to tell
- * you to "pause" sending it bytes when it's own input buffer is full.
- * So, the UART will send XON to you when it's fifo is empty, XON means you can
- * send as many bytes as you have until XOFF is send. Note that these are two
+ * you to "pause" sending it bytes when its own input buffer is full.
+ * So, the UART will send XON to you when its fifo is empty, XON means you can
+ * send as many bytes as you have until XOFF is sent. Note that these are two
* IRQs because you /will/ be called with XOFF when sending a byte in INPUT...
* So it's a reentrant process.
*
* volatile int off = 0;
* void irq_xon()
* {
- * off = 0;
- * while (!off && bytes_lefts)
+ * off = 0;
+ * while (!off && bytes_left)
* avr_raise_irq(UART_IRQ_INPUT, a_byte);
* }
* void irq_xoff()
* {
- * off = 1;
+ * off = 1;
* }
*
*/
avr_regbit_t rxen; // receive enabled
avr_regbit_t txen; // transmit enable
avr_regbit_t u2x; // double UART speed
+ avr_regbit_t usbs; // stop bits
+ avr_regbit_t ucsz; // data bits
+ avr_regbit_t ucsz2; // data bits, continued
avr_io_addr_t r_ubrrl,r_ubrrh;
uart_fifo_t input;
uint32_t flags;
+ avr_cycle_count_t usec_per_byte;
+
+ uint8_t * stdio_out;
+ int stdio_len; // current size in the stdio output
} avr_uart_t;
/* takes a uint32_t* as parameter */