11using namespace MaxOS::hardwarecommunication;
19: m_port_number(port_number)
23Port::~Port() =
default;
34Port8Bit::~Port8Bit() =
default;
43 asm volatile(
"outb %0, %1" : :
"a" (data),
"Nd" (
m_port_number));
54 asm volatile(
"inb %1, %0" :
"=a" (result) :
"Nd" (
m_port_number));
67Port8BitSlow::~Port8BitSlow() =
default;
76 asm volatile(
"outb %0, %1\njmp 1f\n1: jmp 1f\n1:" : :
"a" (data),
"Nd" (
m_port_number));
88Port16Bit::~Port16Bit() =
default;
97 asm volatile(
"outw %0, %1" : :
"a" (data),
"Nd" (
m_port_number));
108 asm volatile(
"inw %1, %0" :
"=a" (result) :
"Nd" (
m_port_number));
121Port32Bit::~Port32Bit() =
default;
130 asm volatile(
"outl %0, %1" : :
"a" (data),
"Nd" (
m_port_number));
141 asm volatile(
"inl %1, %0" :
"=a" (result) :
"Nd" (
m_port_number));
virtual void write(uint16_t data)
write a word to the port
virtual uint16_t read()
read a word from the port
Port16Bit(uint16_t port_number)
Construct a new Port object for ports handling 16 bit read/writes.
virtual uint32_t read()
read a double word from the port (32Bit)
Port32Bit(uint16_t port_number)
Construct a new Port object for ports handling 32 bit read/writes.
virtual void write(uint32_t data)
write a double word to the port (32Bit)
void write(uint8_t data) final
write a byte to the port (slow)
Port8BitSlow(uint16_t port_number)
Construct a new Port object for ports handling 8 bit read/writes (slow)
virtual uint8_t read()
read a byte from the port
Port8Bit(uint16_t port_number)
Construct a new Port object for ports handling 8 bit read/writes.
virtual void write(uint8_t data)
write a byte to the port
Port(uint16_t port_number)
Construct a new Port object.
uint16_t m_port_number
The port to write to / read from.
Defines classes for handling hardware communication ports (8, 16, and 32 bit)