<commit_before>/* automaton
 * (c) 2013 <NAME>
 * The source code of this project is distributed under the terms of the
 * simplified BSD license. See the LICENSE file for details.
 */


/* print debugging information to the lcd (warning: lcd code not int-safe) */
#define UART_DEBUG_FIFO 1

/* count interrupts */
#define UART_DEBUG_INT_COUNT 0


#include "io/uart.h"
#include "algo/fifo.h"
#include "time/alarm.h"


enum uart_state {
	UART_ST_INIT      = _BV(0), // uart has been initialized
	UART_ST_TX_ACTIVE = _BV(1), // interrupt-driven tx is ongoing
	UART_ST_TX_WAIT   = _BV(2), // the last bit is still in the uart's tx buffer
};


struct uart {
	uint8_t state;
	
	uint16_t timeout_tx_ms;
	uint16_t timeout_rx_ms;
	
	struct fifo fifo_tx;
	struct fifo fifo_rx;
	
	volatile uint8_t  *const ucsr_a;
	volatile uint8_t  *const ucsr_b;
	volatile uint8_t  *const ucsr_c;
	volatile uint16_t *const ubrr;
	volatile uint8_t  *const udr;<commit_msg>io/uart: disable fifo debugging<commit_after>/* automaton
 * (c) 2013 <NAME>
 * The source code of this project is distributed under the terms of the
 * simplified BSD license. See the LICENSE file for details.
 */


/* print debugging information to the lcd (warning: lcd code not int-safe) */
#define UART_DEBUG_FIFO 0

/* count interrupts */
#define UART_DEBUG_INT_COUNT 0


#include "io/uart.h"
#include "algo/fifo.h"
#include "time/alarm.h"


enum uart_state {
	UART_ST_INIT      = _BV(0), // uart has been initialized
	UART_ST_TX_ACTIVE = _BV(1), // interrupt-driven tx is ongoing
	UART_ST_TX_WAIT   = _BV(2), // the last bit is still in the uart's tx buffer
};


struct uart {
	uint8_t state;
	
	uint16_t timeout_tx_ms;
	uint16_t timeout_rx_ms;
	
	struct fifo fifo_tx;
	struct fifo fifo_rx;
	
	volatile uint8_t  *const ucsr_a;
	volatile uint8_t  *const ucsr_b;
	volatile uint8_t  *const ucsr_c;
	volatile uint16_t *const ubrr;
	volatile uint8_t  *const udr;
{'fraction_non_alphanumeric': 0.08900523560209424, 'fraction_numerical': 0.020942408376963352, 'mean_word_length': 3.887468030690537, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '565512', 'n_tokens_mistral': 771, 'n_tokens_neox': 698, 'n_words': 226}