MOS Source Code
Loading...
Searching...
No Matches
serial_driver.c
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
4
5#include "mos/device/serial.h"
7
9{
11 return port_inb(port);
12}
13
14static void serial_write_data(serial_device_t *device, u8 data)
15{
17 port_outb(port, data);
18}
19
21{
23 return port_inb(port + reg);
24}
25
27{
29 port_outb(port + reg, data);
30}
31
33 .read_data = serial_read_data,
34 .write_data = serial_write_data,
35 .read_register = serial_read_register,
36 .write_register = serial_write_register,
37};
should_inline void port_outb(u16 port, u8 value)
Definition port.h:31
should_inline u8 port_inb(u16 port)
Definition port.h:10
serial_register_t
Definition serial.h:8
static u8 serial_read_data(serial_device_t *device)
const serial_driver_t x86_serial_driver
static void serial_write_register(serial_device_t *device, serial_register_t reg, u8 data)
static void serial_write_data(serial_device_t *device, u8 data)
static u8 serial_read_register(serial_device_t *device, serial_register_t reg)
x86_com_port_t
void * driver_data
Definition serial.h:83
unsigned long ptr_t
Definition types.h:25
unsigned char u8
Definition types.h:19