device

package
v0.0.0-...-1a7aca4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DetectOrderEarly specifies that the driver's probe function should
	// be executed at the beginning of the HW detection phase. It is used
	// by some of the console and TTY device drivers.
	DetectOrderEarly DetectOrder = -128

	// DetectOrderBeforeACPI specifies that the driver's probe function
	// should be executed before attempting any ACPI-based HW detection but
	// after any drivers with DetectOrderEarly.
	DetectOrderBeforeACPI = -127

	// DetectOrderACPI specifies that the driver's probe function should
	// be executed after parsing the ACPI tables. This is the default (zero
	// value) for all drivers.
	DetectOrderACPI = 0

	// DetectOrderLast specifies that the driver's probe function should
	// be executed at the end of the HW detection phase.
	DetectOrderLast = 127
)

Variables

This section is empty.

Functions

func RegisterDriver

func RegisterDriver(info *DriverInfo)

RegisterDriver adds the supplied driver info to the list of registered drivers. The list can be retrieved by a call to DriverList().

Types

type DetectOrder

type DetectOrder int8

DetectOrder specifies when each driver's probe function will be invoked by the hal package.

type Driver

type Driver interface {
	// DriverName returns the name of the driver.
	DriverName() string

	// DriverVersion returns the driver version.
	DriverVersion() (major uint16, minor uint16, patch uint16)

	// DriverInit initializes the device driver. If the driver init code
	// needs to log some output, it can use the supplied io.Writer in
	// conjunction with a call to kfmt.Fprint.
	DriverInit(io.Writer) *kernel.Error
}

Driver is an interface implemented by all drivers.

type DriverInfo

type DriverInfo struct {
	// Order specifies at which stage of the HW detection step should
	// the probe function be invoked.
	Order DetectOrder

	// Probe is a function that checks for the presence of a particular
	// piece of hardware and returns back a driver for it.
	Probe ProbeFn
}

DriverInfo is a driver-defined struct that is passed to calls to RegisterDriver.

type DriverInfoList

type DriverInfoList []*DriverInfo

DriverInfoList is a list of registered drivers that implements sort.Sort.

func DriverList

func DriverList() DriverInfoList

DriverList returns the list of registered drivers.

func (DriverInfoList) Len

func (l DriverInfoList) Len() int

Len returns the length of the driver info list.

func (DriverInfoList) Less

func (l DriverInfoList) Less(i, j int) bool

Less compares 2 elements of the driver info list.

func (DriverInfoList) Swap

func (l DriverInfoList) Swap(i, j int)

Swap exchanges 2 elements in the driver info list.

type ProbeFn

type ProbeFn func() Driver

ProbeFn is a function that scans for the presence of a particular piece of hardware and returns a driver for it.

Directories

Path Synopsis
aml
video
console/logo
Package logo contains logos that can be used with a framebuffer console.
Package logo contains logos that can be used with a framebuffer console.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL