#include <stdint.h>
#include <Arch/i686/Arch.i686.hpp>
Go to the source code of this file.
Ports header file. Provides inline functions for getting and setting values at different ports. An I/O port is usually used as a technical term for a specific address on the x86's IO bus. This bus provides communication with devices in a fixed order and size, and was used as an alternative to memory access. (https://wiki.osdev.org/I/O_Ports)
- Author
- Keeton Feavel (keeto.nosp@m.nfea.nosp@m.vel@c.nosp@m.edar.nosp@m.ville.nosp@m..edu)
- Version
- 0.3
- Date
- 2019-09-26
- Copyright
- Copyright Keeton Feavel (c) 2019
Definition in file ports.hpp.
◆ readByte()
uint8_t readByte |
( |
uint16_t |
port | ) |
|
Reads a byte (8 bits) off the CPU bus at a given port address.
- Parameters
-
- Returns
- uint8_t Returned data byte
Definition at line 13 of file ports.cpp.
15 asm volatile(
"inb %1, %0" :
"=a" (result) :
"Nd" (port));
◆ readLong()
uint32_t readLong |
( |
uint16_t |
port | ) |
|
Reads a long (32 bits) off the CPU bus at a given port address.
- Parameters
-
- Returns
- uint8_t Returned data long
Definition at line 37 of file ports.cpp.
39 asm volatile(
"inl %1, %0" :
"=a" (result) :
"Nd" (port));
◆ readWord()
uint16_t readWord |
( |
uint16_t |
port | ) |
|
Reads a word (16 bits) off the CPU bus at a given port address.
- Parameters
-
- Returns
- uint8_t Returned data word
Definition at line 27 of file ports.cpp.
29 asm volatile(
"inw %1, %0" :
"=a" (result) :
"Nd" (port));
◆ writeByte()
void writeByte |
( |
uint16_t |
port, |
|
|
uint8_t |
data |
|
) |
| |
Writes a byte (8 bits) to the CPU bus at a given port address.
- Parameters
-
port | Port address |
data | Byte to be written to the port |
Definition at line 19 of file ports.cpp.
20 asm volatile(
"outb %0, %1" : :
"a" (data),
"Nd" (port));
◆ writeByteSlow()
void writeByteSlow |
( |
uint16_t |
port, |
|
|
uint8_t |
data |
|
) |
| |
Writes a byte (8 bits) slowly to the CPU bus at a given port address.
- Parameters
-
port | Port address |
data | Byte to be written to the port |
Definition at line 23 of file ports.cpp.
24 asm volatile(
"outb %0, %1\njmp 1f\n1: jmp 1f\n1:" : :
"a" (data),
"Nd" (port));
◆ writeLong()
void writeLong |
( |
uint16_t |
port, |
|
|
uint32_t |
data |
|
) |
| |
Writes a long (32 bits) to the CPU bus at a given port address.
- Parameters
-
port | Port address |
data | Long to be written to the port |
Definition at line 43 of file ports.cpp.
44 asm volatile(
"outl %0, %1" : :
"a"(data),
"Nd" (port));
◆ writeWord()
void writeWord |
( |
uint16_t |
port, |
|
|
uint16_t |
data |
|
) |
| |
Writes a word (16 bits) to the CPU bus at a given port address.
- Parameters
-
port | Port address |
data | Word to be written to the port |
Definition at line 33 of file ports.cpp.
34 asm volatile(
"outw %0, %1" : :
"a" (data),
"Nd" (port));