mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
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.
23 lines
358 B
C++
23 lines
358 B
C++
#include "io.h"
|
|
|
|
uint8_t
|
|
inb(uint16_t port)
|
|
{
|
|
uint8_t val;
|
|
__asm__ __volatile__ ( "inb %1, %0" : "=a"(val) : "Nd"(port) );
|
|
return val;
|
|
}
|
|
|
|
void
|
|
outb(uint16_t port, uint8_t val)
|
|
{
|
|
__asm__ __volatile__ ( "outb %0, %1" :: "a"(val), "Nd"(port) );
|
|
}
|
|
|
|
void
|
|
io_wait(unsigned times)
|
|
{
|
|
for (unsigned i = 0; i < times; ++i)
|
|
outb(0x80, 0);
|
|
}
|