mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Drivers can use the writer as an argument to kfmt.Fprintf to log additional output during their initialization.
25 lines
674 B
Go
25 lines
674 B
Go
package device
|
|
|
|
import (
|
|
"gopheros/kernel"
|
|
"io"
|
|
)
|
|
|
|
// Driver is an interface implemented by all drivers.
|
|
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
|
|
}
|
|
|
|
// ProbeFn is a function that scans for the presence of a particular
|
|
// piece of hardware and returns a driver for it.
|
|
type ProbeFn func() Driver
|