aboutsummaryrefslogtreecommitdiff
path: root/kernel/io/include
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-03-30 22:38:35 +0200
committerJakob Odersky <jodersky@gmail.com>2014-03-30 22:38:35 +0200
commitf93ab955074e213ad6f2bf60522cc86952d57d83 (patch)
tree65af07c02d6f0541f31cddef9cd564189395952b /kernel/io/include
parent2500120f64db83fc682f38a83f7f9e03ed8a5123 (diff)
downloadmux-f93ab955074e213ad6f2bf60522cc86952d57d83.tar.gz
mux-f93ab955074e213ad6f2bf60522cc86952d57d83.tar.bz2
mux-f93ab955074e213ad6f2bf60522cc86952d57d83.zip
major update
Diffstat (limited to 'kernel/io/include')
-rw-r--r--kernel/io/include/io/usart.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/io/include/io/usart.h b/kernel/io/include/io/usart.h
new file mode 100644
index 0000000..62e2768
--- /dev/null
+++ b/kernel/io/include/io/usart.h
@@ -0,0 +1,31 @@
+#ifndef SERIAL_H
+#define SERIAL_H
+
+#include "collection/rbuffer.h"
+#include "collection/list.h"
+
+#define USARTS 1
+#define USART_BUFFER_SIZE 64
+
+struct usart_device_t {
+ volatile char __rx_buffer[USART_BUFFER_SIZE];
+ volatile char __tx_buffer[USART_BUFFER_SIZE];
+
+ struct rbuffer_t rx_buffer;
+ struct rbuffer_t tx_buffer;
+
+ struct list_head rx_queue;
+ struct list_head tx_queue;
+};
+
+#define USART_DEVICE_INIT(name) \
+ { \
+ .rx_buffer = RBUFFER_ARRAY_INIT(name.__rx_buffer, USART_BUFFER_SIZE), \
+ .tx_buffer = RBUFFER_ARRAY_INIT(name.__tx_buffer, USART_BUFFER_SIZE), \
+ .rx_queue = LIST_HEAD_INIT(name.rx_queue), \
+ .tx_queue = LIST_HEAD_INIT(name.tx_queue) \
+ }
+
+void usart_init(unsigned long baud);
+
+#endif \ No newline at end of file