Files
jsix/src/kernel/serial.h
F in Chat for Tabs 8f529046a9 [project] Lose the battle between tabs & spaces
I'm a tabs guy. I like tabs, it's an elegant way to represent
indentation instead of brute-forcing it. But I have to admit that the
world seems to be going towards spaces, and tooling tends not to play
nice with tabs. So here we go, changing the whole repo to spaces since
I'm getting tired of all the inconsistent formatting.
2021-08-01 17:46:16 -07:00

34 lines
601 B
C++

#pragma once
/// \file serial.h
/// Declarations related to serial ports.
#include <stdint.h>
#include "kutil/bip_buffer.h"
class serial_port
{
public:
/// Constructor.
/// \arg port The IO address of the serial port
serial_port(uint16_t port);
serial_port();
void write(char c);
char read();
void handle_interrupt();
private:
bool m_writing;
uint16_t m_port;
kutil::bip_buffer m_out_buffer;
kutil::bip_buffer m_in_buffer;
void do_read();
void do_write();
void handle_error(uint16_t reg, uint8_t value);
};
extern serial_port &g_com1;