FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
hal.h File Reference

Header file for Hardware Abstraction Layer -> Source from GoGX OS. More...

#include <stdint.h>
#include <basics.h>
Include dependency graph for hal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pic1_command   0x20
#define pic1_data   0x21
#define pic2_command   0xA0
#define pic2_data   0xA1

Functions

void init_hardware_abstraction_layer ()
 Initializes HAL by remapping the PIC interrupts to avoid conflicts.
void outb (int16 port, int8 value)
 Output a byte to the specified I/O port.
int8 inb (int16 port)
 Read a byte from the specified I/O port.
void outw (int16 portNumber, int16 data)
 Output a 16-bit value to the specified I/O port.
int16 inw (int16 portNumber)
 Read a 16-bit value from the specified I/O port.
int32 inl (int16 portNumber)
 Read a 32-bit value from the specified I/O port.
void outl (int16 portNumber, int32 data)
 Output a 32-bit value to the specified I/O port.
void io_wait ()
 Perform an I/O wait operation.

Detailed Description

Header file for Hardware Abstraction Layer -> Source from GoGX OS.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
v1.0
Date
2022-08-03

Definition in file hal.h.

Macro Definition Documentation

◆ pic1_command

#define pic1_command   0x20

Definition at line 15 of file hal.h.

◆ pic1_data

#define pic1_data   0x21

Definition at line 16 of file hal.h.

◆ pic2_command

#define pic2_command   0xA0

Definition at line 17 of file hal.h.

◆ pic2_data

#define pic2_data   0xA1

Definition at line 18 of file hal.h.

Function Documentation

◆ inb()

int8 inb ( int16 port)

Read a byte from the specified I/O port.

This function reads a byte from the specified I/O port using inline assembly.

Parameters
portThe 16-bit I/O port number.
Returns
The 8-bit value read from the port.

◆ inl()

int32 inl ( int16 portNumber)

Read a 32-bit value from the specified I/O port.

This function reads a 32-bit value from the specified I/O port using inline assembly.

Parameters
portNumberThe 16-bit I/O port number.
Returns
The 32-bit value read from the port.

◆ inw()

int16 inw ( int16 portNumber)

Read a 16-bit value from the specified I/O port.

This function reads a 16-bit value from the specified I/O port using inline assembly.

Parameters
portNumberThe 16-bit I/O port number.
Returns
The 16-bit value read from the port.

◆ io_wait()

void io_wait ( )

Perform an I/O wait operation.

This function performs an I/O wait operation using inline assembly. It is used to add a small delay in I/O operations.

◆ outb()

void outb ( int16 port,
int8 value )

Output a byte to the specified I/O port.

This function sends a byte to the specified I/O port using inline assembly.

Parameters
portThe 16-bit I/O port number.
valueThe 8-bit value to be sent to the port.

◆ outl()

void outl ( int16 portNumber,
int32 data )

Output a 32-bit value to the specified I/O port.

This function sends a 32-bit value to the specified I/O port using inline assembly.

Parameters
portNumberThe 16-bit I/O port number.
dataThe 32-bit value to be sent to the port.

◆ outw()

void outw ( int16 portNumber,
int16 data )

Output a 16-bit value to the specified I/O port.

This function sends a 16-bit value to the specified I/O port using inline assembly.

Parameters
portNumberThe 16-bit I/O port number.
dataThe 16-bit value to be sent to the port.