X-Git-Url: https://jxself.org/git/?p=linux-libre-firmware.git;a=blobdiff_plain;f=atusb%2Fuart.c;fp=atusb%2Fuart.c;h=44bec27a4961e182572306ba3591d7b843b0f261;hp=0000000000000000000000000000000000000000;hb=dd4bc9ff49b9a7075e579fdd62fd930d27a9a7df;hpb=c164bf7f87f9081fee7e1a186dd7a87a9a020b9e diff --git a/atusb/uart.c b/atusb/uart.c new file mode 100644 index 0000000..44bec27 --- /dev/null +++ b/atusb/uart.c @@ -0,0 +1,64 @@ +/* + * fw/uart.h - Functions needed for debugging over uart + * + * Code adapted from http://www.roboternetz.de/wissen/index.php/UART_mit_avr-gcc + * and http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial + * + * Published under the Creative Commons Share-Alike licence + * https://creativecommons.org/licenses/by-sa/2.0/de/ + * + * S. Salewski 2007 + * + * Adapted by + * Josef Filzmaier 2017 + */ + +#include +#include "uart.h" + +#define USART_BAUD 38400UL +#define F_CPU 8000000UL + +#define Wait_USART_Ready() while (!(UCSR1A & (1<