# Unit PCI

Description
Uses
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Variables

## Description

Driver->Bus->`PCI` - Peripheral Component Interconnect Driver.

## Uses

- tracer
- util
- console
- drivertypes
- lmemorymanager
- vmemorymanager
- drivermanagement

## Overview

### Functions and Procedures

`procedure init();`
`procedure scanBus(bus : uint8);`
`function loadDeviceConfig(bus : uint8; slot : uint8; func : uint8) : boolean;`
`function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint8; var count : uint32) : TdeviceArray;`
`procedure requestConfig(bus : uint8; slot : uint8; func : uint8; row : uint8);`
`procedure writeConfig(bus: uint8; slot : uint8; func : uint8; row : uint8; val : uint32);`
`procedure setBusMaster(bus : uint8; slot : uint8; func : uint8; master : boolean);`

### Types

`TPCI_Device_Bridge = bitpacked record device_id : uint16; vendor_id : uint16; status : uint16; command : uint16; class_code : uint8; subclass_class : uint8; prog_if : uint8; revision_id : uint8; BIST : uint8; header_type : uint8; latency_timer : uint8; cache_size : uint8; address0 : uint32; address1 : uint32; latency_timer2 : uint8; subordinate_bus : uint8; secondery_bus : uint8; primary_bus : uint8; secondery_status : uint16; io_limit : uint8; io_base : uint8; memory_limit : uint16; memory_base : uint16; pref_memory_limit : uint16; pref_memory_base : uint16; pref_base_upper : uint32; pref_limit_upper : uint32; io_limit_upper : uint16; io_base_upper : uint16; reserved : uint16; reserved0 : uint8; capability_pointer : uint8; epx_rom_addr : uint32; bridge_control : uint16; interrupt_pin : uint8; interrupt_line : uint8; end;`

### Constants

`PCI_PORT_CONF_ADDR = $CF8;`
`PCI_PORT_CONF_DATA = $CFC;`

### Variables

`devices: array[0..1024] of TPCI_Device;`
`busses: array[0..256] of TPCI_Device_Bridge;`
`device_count: uint16;`
`bus_count: uint8 = 1;`
`get_device_count: uint8;`

## Description

### Functions and Procedures

`procedure init();`

`procedure scanBus(bus : uint8);`

`function loadDeviceConfig(bus : uint8; slot : uint8; func : uint8) : boolean;`

`function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint8; var count : uint32) : TdeviceArray;`

`procedure requestConfig(bus : uint8; slot : uint8; func : uint8; row : uint8);`
(Will in future)returns TPCI_DEVICE.vendor_id := 0xFFFF if no device found.

`procedure writeConfig(bus: uint8; slot : uint8; func : uint8; row : uint8; val : uint32);`

`procedure setBusMaster(bus : uint8; slot : uint8; func : uint8; master : boolean);`

### Types

`TPCI_Device_Bridge = bitpacked record device_id : uint16; vendor_id : uint16; status : uint16; command : uint16; class_code : uint8; subclass_class : uint8; prog_if : uint8; revision_id : uint8; BIST : uint8; header_type : uint8; latency_timer : uint8; cache_size : uint8; address0 : uint32; address1 : uint32; latency_timer2 : uint8; subordinate_bus : uint8; secondery_bus : uint8; primary_bus : uint8; secondery_status : uint16; io_limit : uint8; io_base : uint8; memory_limit : uint16; memory_base : uint16; pref_memory_limit : uint16; pref_memory_base : uint16; pref_base_upper : uint32; pref_limit_upper : uint32; io_limit_upper : uint16; io_base_upper : uint16; reserved : uint16; reserved0 : uint8; capability_pointer : uint8; epx_rom_addr : uint32; bridge_control : uint16; interrupt_pin : uint8; interrupt_line : uint8; end;`

### Constants

`PCI_PORT_CONF_ADDR = $CF8;`

`PCI_PORT_CONF_DATA = $CFC;`

### Variables

`devices: array[0..1024] of TPCI_Device;`

`busses: array[0..256] of TPCI_Device_Bridge;`

`device_count: uint16;`

`bus_count: uint8 = 1;`

`get_device_count: uint8;`

## Authors

- Aaron Hance <ah@aaronhance.me>
- Kieron Morris <kjm@kieronmorris.me>

Generated by PasDoc 0.15.0.