summaryrefslogtreecommitdiffstats
path: root/src/include/bits/ns16550.h
diff options
context:
space:
mode:
authorSimon Rettberg2026-01-28 12:53:53 +0100
committerSimon Rettberg2026-01-28 12:53:53 +0100
commit8e82785c584dc13e20f9229decb95bd17bbe9cd1 (patch)
treea8b359e59196be5b2e3862bed189107f4bc9975f /src/include/bits/ns16550.h
parentMerge branch 'master' into openslx (diff)
parent[prefix] Make unlzma.S compatible with 386 class CPUs (diff)
downloadipxe-openslx.tar.gz
ipxe-openslx.tar.xz
ipxe-openslx.zip
Merge branch 'master' into openslxopenslx
Diffstat (limited to 'src/include/bits/ns16550.h')
-rw-r--r--src/include/bits/ns16550.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/include/bits/ns16550.h b/src/include/bits/ns16550.h
new file mode 100644
index 000000000..45e3e978f
--- /dev/null
+++ b/src/include/bits/ns16550.h
@@ -0,0 +1,42 @@
+#ifndef _BITS_NS16550_H
+#define _BITS_NS16550_H
+
+/** @file
+ *
+ * 16550-compatible UART
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <stdint.h>
+#include <ipxe/io.h>
+
+/**
+ * Write to UART register
+ *
+ * @v ns16550 16550 UART
+ * @v address Register address
+ * @v data Data
+ */
+static inline __attribute__ (( always_inline )) void
+ns16550_write ( struct ns16550_uart *ns16550, unsigned int address,
+ uint8_t data ) {
+
+ iowrite8 ( data, ( ns16550->base + ( address << ns16550->shift ) ) );
+}
+
+/**
+ * Read from UART register
+ *
+ * @v ns16550 16550 UART
+ * @v address Register address
+ * @ret data Data
+ */
+static inline __attribute__ (( always_inline )) uint8_t
+ns16550_read ( struct ns16550_uart *ns16550, unsigned int address ) {
+
+ return ioread8 ( ns16550->base + ( address << ns16550->shift ) );
+}
+
+#endif /* _BITS_NS16550_H */