OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
port_io.h File Reference

c wrappers for asm port operations More...

#include "stdint.h"

Go to the source code of this file.

Functions

static uint8_t inb (uint16_t port)
 read byte from low level port
 
static void outb (uint16_t port, uint8_t val)
 write byte to low level port
 
static uint16_t inw (uint16_t port)
 read word from low level port
 
static void outw (uint16_t port, uint16_t val)
 write word to low level port
 
static uint32_t inl (uint16_t port)
 read double word from low level port
 
static void outl (uint16_t port, uint32_t val)
 write double word to low level port
 
static void io_wait (void)
 perform a short wait (1-4 microseconds)
 

Detailed Description

c wrappers for asm port operations

Function Documentation

◆ inb()

static uint8_t inb ( uint16_t  port)
inlinestatic

read byte from low level port

Parameters
portport to read from
Returns
value in port

◆ inl()

static uint32_t inl ( uint16_t  port)
inlinestatic

read double word from low level port

Parameters
portport to read from
Returns
value in port

◆ inw()

static uint16_t inw ( uint16_t  port)
inlinestatic

read word from low level port

Parameters
portport to read from
Returns
value in port

◆ io_wait()

static void io_wait ( void  )
inlinestatic

perform a short wait (1-4 microseconds)

This function outputs to a random unused port (0x80 is almost always unused after booting) Since output takes some time, this function can work as a small wait

◆ outb()

static void outb ( uint16_t  port,
uint8_t  val 
)
inlinestatic

write byte to low level port

Parameters
portport to write to
valvalue to write to port

◆ outl()

static void outl ( uint16_t  port,
uint32_t  val 
)
inlinestatic

write double word to low level port

Parameters
portport to write to
valvalue to write to port

◆ outw()

static void outw ( uint16_t  port,
uint16_t  val 
)
inlinestatic

write word to low level port

Parameters
portport to write to
valvalue to write to port