aboutsummaryrefslogtreecommitdiff
path: root/devices/uart
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2023-06-29 21:45:11 +0300
committeraqua <aqua@iserlohn-fortress.net>2023-06-29 21:45:11 +0300
commiteb84566d236df6b0dd4f5ce8fc47d66e55e33654 (patch)
tree7e03ca126781c67336edf9f3ce6888aad23f74e4 /devices/uart
parentRework leaf makefiles to be included from top-level (diff)
downloadkernel-eb84566d236df6b0dd4f5ce8fc47d66e55e33654.tar.xz
Fix compiler warnings
Diffstat (limited to 'devices/uart')
-rw-r--r--devices/uart/uart_16550.c14
-rw-r--r--devices/uart/uart_16550.h6
2 files changed, 11 insertions, 9 deletions
diff --git a/devices/uart/uart_16550.c b/devices/uart/uart_16550.c
index 0e19842..4697cf3 100644
--- a/devices/uart/uart_16550.c
+++ b/devices/uart/uart_16550.c
@@ -2,7 +2,7 @@
#include <stddef.h>
int
-uart_thre(enum UART port)
+uart_thre(unsigned short port)
{
return inb(port + LineStatus) & THRE;
}
@@ -10,12 +10,14 @@ uart_thre(enum UART port)
void
uart_putc(const FILE *self, char a)
{
- while (uart_thre((enum UART)self->id) == 0) {}
- outb(a, self->id);
+ const unsigned short port = (unsigned short)self->id;
+
+ while (uart_thre(port) == 0) {}
+ outb((unsigned char)a, port);
if (a == '\n') {
- while (uart_thre((enum UART)self->id) == 0) {}
- outb('\r', self->id);
+ while (uart_thre(port) == 0) {}
+ outb('\r', port);
}
}
@@ -49,7 +51,7 @@ uart_flush(__attribute__((unused)) const FILE *self)
FILE uart_stream;
FILE *
-uart_init(enum UART port)
+uart_init(unsigned short port)
{
outb(0x00, port + 1); /* Disable all interrupts */
outb(0x80, port + 3); /* Enable DLAB (set baud rate divisor) */
diff --git a/devices/uart/uart_16550.h b/devices/uart/uart_16550.h
index 176dea2..d4f470e 100644
--- a/devices/uart/uart_16550.h
+++ b/devices/uart/uart_16550.h
@@ -2,7 +2,7 @@
#include "../uart.h"
-int uart_thre(enum UART port);
+int uart_thre(unsigned short port);
void uart_putc(const FILE *self, char a);
int uart_puts(const FILE *self, const char *string, int length);
void uart_flush(__attribute__((unused)) const FILE *self);
@@ -15,7 +15,7 @@ enum uart_16550_offset {
ModemControl = 4,
LineStatus = 5,
ModemStatus = 6,
- Scratch = 7,
+ Scratch = 7
};
/* Line Control
@@ -45,5 +45,5 @@ enum LineStatus {
BI = (1 << 4), /* break indicator: see if there is a break in data input */
THRE = (1 << 5), /* transmitter holding register empty: see if transmission buffer is empty */
TEMT = (1 << 6), /* transmitter empty: see if transmitter is not doing anything */
- ERRO = (1 << 7), /* impending error: see if there is an error with a word in the input buffer */
+ ERRO = (1 << 7) /* impending error: see if there is an error with a word in the input buffer */
};