summaryrefslogtreecommitdiff
path: root/gm_platform/fw/serial.h
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-01-23 14:38:36 +0100
committerjaseg <git@jaseg.net>2020-01-23 14:38:36 +0100
commit410e38651052038e34843b17269d61e75720f0ba (patch)
tree987d1853c55b152d5e1362af4420fa52fcd56a81 /gm_platform/fw/serial.h
parent6a49b8399fb156d427b5d15746de877ac933ba3d (diff)
downloadmaster-thesis-410e38651052038e34843b17269d61e75720f0ba.tar.gz
master-thesis-410e38651052038e34843b17269d61e75720f0ba.tar.bz2
master-thesis-410e38651052038e34843b17269d61e75720f0ba.zip
board bringup: adc, usart working
Diffstat (limited to 'gm_platform/fw/serial.h')
-rw-r--r--gm_platform/fw/serial.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/gm_platform/fw/serial.h b/gm_platform/fw/serial.h
new file mode 100644
index 0000000..55eac9e
--- /dev/null
+++ b/gm_platform/fw/serial.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the libusbhost library
+ * hosted at http://github.com/libusbhost/libusbhost
+ *
+ * Copyright (C) 2015 Amir Hammad <amir.hammad@hotmail.com>
+ *
+ *
+ * libusbhost is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __SERIAL_H__
+#define __SERIAL_H__
+
+#include <stdint.h>
+#include <stdarg.h>
+#include <errno.h>
+
+struct dma_tx_buf {
+ size_t xfr_start; /* Start index of running DMA transfer */
+ size_t xfr_end; /* End index of running DMA transfer plus one */
+ size_t wr_pos; /* Next index to be written */
+ uint8_t data[256];
+};
+
+extern volatile struct dma_tx_buf usart_tx_buf;
+
+void usart_dma_init(void);
+int usart_dma_fifo_push(volatile struct dma_tx_buf *buf, char c);
+void usart_putc(char c);
+void usart_send_packet(const uint8_t *data, size_t len);
+
+#endif // __SERIAL_H__