You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
415 B
C++
25 lines
415 B
C++
4 weeks ago
|
#ifndef PORTIO_HPP
|
||
|
#define PORTIO_HPP
|
||
|
|
||
|
#include <cstdint>
|
||
|
|
||
|
inline void outb(std::uint16_t port, std::uint8_t val)
|
||
|
{
|
||
|
asm volatile("outb %b0, %w1" :: "a"(val), "Nd"(port) : "memory");
|
||
|
}
|
||
|
|
||
|
inline std::uint8_t inb(std::uint16_t port)
|
||
|
{
|
||
|
std::uint8_t val;
|
||
|
asm volatile("inb %w1, %b0" : "=a"(val) : "Nd"(port) : "memory");
|
||
|
return val;
|
||
|
}
|
||
|
|
||
|
inline void io_wait()
|
||
|
{
|
||
|
outb(0x80, 0);
|
||
|
}
|
||
|
|
||
|
#endif // PORTIO_HPP
|
||
|
|