aboutsummaryrefslogtreecommitdiff
path: root/avr/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/uart.c')
-rw-r--r--avr/uart.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/avr/uart.c b/avr/uart.c
new file mode 100644
index 0000000..2a22181
--- /dev/null
+++ b/avr/uart.c
@@ -0,0 +1,42 @@
+/************************************************************************/
+/* */
+/* File: avr/uart.c */
+/* Description: serial line device. */
+/* Version: 1.0 */
+/* Author: Otto Mattik */
+/* */
+/* (C)Copyright Otto Mattik 2014-2021. */
+/* */
+/* This file is a part of 'armen' (a tiny operating system). */
+/* 'armen' is distributed under the CeCILL-V2.1 licence. For more */
+/* details about this licence, please visit the website cecill.info */
+/* */
+/************************************************************************/
+
+#ifndef AVR_UART_C
+ #error "do not use this code directly, it must be included via uart.c"
+#endif
+
+#if defined(__AVR_ATtiny84__)\
+ || defined(__AVR_ATtiny85__)
+ #include "avr/usi.c"
+#else
+ #include "avr/usart.c"
+#endif
+
+void _uart_init( void )
+{
+ uint8_t i;
+
+ for( i = 0; i < ARMEN_UARTS; i++ )
+ {
+ devices[i].open = _uart_open;
+ devices[i].close = _uart_close;
+ devices[i].read = _uart_read;
+ devices[i].write = _uart_write;
+ #ifdef UART_IOCTL
+ devices[i].ioctl = _uart_ioctl;
+ #endif
+ }
+}
+