laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/30763 )


Change subject: WIP: Add software UART implementation
......................................................................

WIP: Add software UART implementation

Change-Id: I2ca95963fd5852ddb89bdd35b86b31489127fe84
---
M include/Makefile.am
A include/osmocom/core/soft_uart.h
M src/Makefile.am
3 files changed, 35 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/30763/1

diff --git a/include/Makefile.am b/include/Makefile.am
index f857304..f2edbb9 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -51,6 +51,7 @@
                        osmocom/core/sercomm.h \
                        osmocom/core/signal.h \
                        osmocom/core/socket.h \
+                       osmocom/core/soft_uart.h \
                        osmocom/core/statistics.h \
                        osmocom/core/strrb.h \
                        osmocom/core/talloc.h \
diff --git a/include/osmocom/core/soft_uart.h b/include/osmocom/core/soft_uart.h
new file mode 100644
index 0000000..aabbec7
--- /dev/null
+++ b/include/osmocom/core/soft_uart.h
@@ -0,0 +1,33 @@
+#pragma once
+#include <stdint.h>
+#include <osmocom/core/bits.h>
+#include <osmocom/core/msgb.h>
+
+enum osmo_uart_parity_mode {
+       OSMO_SUART_PARITY_NONE,
+       OSMO_SUART_PAIRTY_EVEN,
+       OSMO_SUART_PAIRTY_ODD,
+};
+
+struct osmo_soft_uart_cfg {
+       uint8_t num_data_bits;
+       uint8_t num_stop_bits;
+       enum osmo_uart_parity_mode parity_mode;
+};
+
+struct osmo_soft_uart {
+       struct osmo_soft_uart_cfg cfg;
+       struct {
+               uint8_t bit_count;
+               uint8_t shift_reg;
+               struct msgb *msg;
+               ubit_t parity_bit;
+       } rx;
+       struct {
+               uint8_t bit_count;
+               uint8_t shift_reg;
+               struct msgb *msg;
+       } tx;
+};
+
+int osmo_soft_uart_rx_ubits(struct osmo_soft_uart *sua, const ubit_t *ubits, 
size_t n_ubits);
diff --git a/src/Makefile.am b/src/Makefile.am
index 2c73af6..756724f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,7 @@
                         it_q.c \
                         probes.d \
                         base64.c \
+                        soft_uart.c \
                         $(NULL)

 if HAVE_SSSE3

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30763
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2ca95963fd5852ddb89bdd35b86b31489127fe84
Gerrit-Change-Number: 30763
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to