Turnstone Operating System
Loading...
Searching...
No Matches
ports.h File Reference

i/o port functions More...

#include <types.h>

Macros

#define ___PORTS_H   0
 
#define COM1   0x03F8
 
#define COM2   0x02F8
 
#define COM3   0x03E8
 
#define COM4   0x02E8
 

Functions

static void outb (uint16_t port, uint8_t data)
 write one byte to the port More...
 
static uint8_t inb (uint16_t port)
 read one byte from the port More...
 
static void outw (uint16_t port, uint16_t data)
 write one word (two bytes) to the port More...
 
static uint16_t inw (uint16_t port)
 read one word (two bytes) from the port More...
 
static void outl (uint16_t port, uint32_t data)
 write double word (four bytes) to the port More...
 
static uint32_t inl (uint16_t port)
 read double word (four bytes) from the port More...
 
void init_serial (uint16_t port)
 setups serial port More...
 
uint8_t read_serial (uint16_t port)
 reads one byte from serial port More...
 
void write_serial (uint16_t port, uint8_t data)
 writes one byte to serial port More...
 

Detailed Description

i/o port functions

this functions uses inline assembly

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ ___PORTS_H

#define ___PORTS_H   0

prevent duplicate header error macro

◆ COM1

#define COM1   0x03F8

COM1 value

Function Documentation

◆ inb()

static uint8_t inb ( uint16_t  port)
inlinestatic

read one byte from the port

Parameters
[in]portport to write
Returns
one byte data

◆ init_serial()

void init_serial ( uint16_t  port)

setups serial port

Parameters
[in]portport to setups

◆ inl()

static uint32_t inl ( uint16_t  port)
inlinestatic

read double word (four bytes) from the port

Parameters
[in]portport to write
Returns
double word (four bytes) data

◆ inw()

static uint16_t inw ( uint16_t  port)
inlinestatic

read one word (two bytes) from the port

Parameters
[in]portport to write
Returns
one word (two bytes) data

◆ outb()

static void outb ( uint16_t  port,
uint8_t  data 
)
inlinestatic

write one byte to the port

Parameters
[in]portport to write
[in]dataone byte data to write

◆ outl()

static void outl ( uint16_t  port,
uint32_t  data 
)
inlinestatic

write double word (four bytes) to the port

Parameters
[in]portport to write
[in]datadouble word (four bytes) data to write

◆ outw()

static void outw ( uint16_t  port,
uint16_t  data 
)
inlinestatic

write one word (two bytes) to the port

Parameters
[in]portport to write
[in]dataone word (two bytes) data to write

◆ read_serial()

uint8_t read_serial ( uint16_t  port)

reads one byte from serial port

Parameters
[in]portport to read
Returns
readed value

◆ write_serial()

void write_serial ( uint16_t  port,
uint8_t  data 
)

writes one byte to serial port

Parameters
[in]portport to write
[in]datadata value to be writen