ArvernOS
Loading...
Searching...
No Matches
pci.h File Reference
#include <stdint.h>
Include dependency graph for pci.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  pci_device_t
 

Functions

pci_device_t pci_get_device (uint16_t vendor_id, uint16_t device_id)
 
uint32_t pci_read (pci_device_t device, uint32_t field, uint8_t size)
 
void pci_write (pci_device_t device, uint32_t field, uint32_t value)
 

Detailed Description

See also
https://wiki.osdev.org/PCI

This module manages the Peripheral Component Interconnect (PCI) bus.

Function Documentation

◆ pci_get_device()

pci_device_t pci_get_device ( uint16_t vendor_id,
uint16_t device_id )

Given a vendor_id and device_id, this function returns the corresponding PCI device if it exists.

Parameters
vendor_idID of the manufacturer of the device
device_idID of the particular device
Returns
the PCI device or a zero'ed structure
Todo
This is the minimal amount of code to retrieve a PCI device when there is only one with the same vendor and device IDs and no function.

◆ pci_read()

uint32_t pci_read ( pci_device_t device,
uint32_t field,
uint8_t size )

Reads a field from the configuration space.

Parameters
devicethe PCI device
fieldthe field to read
sizethe size of the value for the field to read
Returns
the value for the field read

◆ pci_write()

void pci_write ( pci_device_t device,
uint32_t field,
uint32_t value )

Writes a value to a field in the configuration space.

Parameters
devicethe PCI device
fieldthe field to update
valuethe new value for the field