pata

package
v0.0.0-...-dfe74e1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDE_IDLE = iota
	IDE_CMD
	IDE_DATA_IN
	IDE_DATA_OUT
)
View Source
const (
	// controller errors (bits!)
	ERR_NO_ADDR_MARK       = byte(1)
	ERR_NO_TRACK0          = byte(2)
	ERR_COMMAND_ABORTED    = byte(4)
	ERR_MEDIA_CHANGE_REQ   = byte(8)
	ERR_NO_ID_MARK_FOUND   = byte(16)
	ERR_MEDIA_CHANGED      = byte(32)
	ERR_UNCORRECTABLE_DATA = byte(64)
	ERR_BAD_BLOCK          = byte(128)

	DEVH_HEAD = byte(15)
	DEVH_DEV  = byte(16)
	DEVH_LBA  = byte(64)

	BIT0 = byte(1)
	BIT1 = byte(2)
	BIT2 = byte(4)
	BIT3 = byte(8)
	BIT4 = byte(16)
	BIT5 = byte(32)
	BIT6 = byte(64)
	BIT7 = byte(128)

	// controller statusa (bits)
	ST_ERR  = byte(1)
	ST_IDX  = byte(2)
	ST_CORR = byte(4)
	ST_DRQ  = byte(8)
	ST_DSC  = byte(16) // drive seek complete
	ST_DF   = byte(32)
	ST_DRDY = byte(64)
	ST_BSY  = byte(128)

	// addresses (address offset)
	REG_PATA_DATA     = uint32(0) // data8 and data16
	REG_PATA_ERROR    = uint32(2) // error on read, feature on write
	REG_PATA_SECT_CNT = uint32(4)
	REG_PATA_SECT_SRT = uint32(6)  // 06: LBA0: low
	REG_PATA_CLDR_LO  = uint32(8)  // 08: LBA1: med
	REG_PATA_CLDR_HI  = uint32(10) // 0a: LBA2: hi
	REG_PATA_DEVH     = uint32(12) // 0c: LBA3: top - bit 24 to 27
	REG_PATA_CMD_STAT = uint32(14) // 0e: command or status (write or read)
)
View Source
const (
	LOG_FATAL = iota
	LOG_ERROR
	LOG_INFO
	LOG_DEBUG
	LOG_TRACE
	LOG_VERBOSE
)
View Source
const (
	CMD_READ = 0x20
)

Variables

View Source
var REG = []string{
	"PATA_DATA lo",
	"PATA_DATA hi",
	"PATA_ERROR",
	"offset 0x03",
	"PATA_SECT_CNT",
	"offset 0x05",
	"PATA_SECT_SRT / LBA0",
	"offset 0x07",
	"PATA_CLDR_LO  / LBA1",
	"offset 0x09",
	"PATA_CLDR_HI  / LBA2",
	"offset 0x0b",
	"PATA_DEVH     / LBA3",
	"offset 0x0d",
	"PATA_CMD_STAT",
	"offset 0x0f",
}

for debug purposes

Functions

This section is empty.

Types

type DRIVE

type DRIVE struct {
	// contains filtered or unexported fields
}

type PATA

type PATA struct {
	// contains filtered or unexported fields
}

func New

func New(name string, size int) *PATA

func (*PATA) AttachDisk

func (s *PATA) AttachDisk(number byte, path string) error

func (*PATA) Clear

func (s *PATA) Clear()

func (*PATA) DetachDisk

func (s *PATA) DetachDisk(number byte)

func (*PATA) Name

func (s *PATA) Name(fn byte) string

func (*PATA) Read

func (s *PATA) Read(fn byte, addr uint32) (byte, error)

func (*PATA) Size

func (s *PATA) Size(fn byte) (uint32, uint32)

func (*PATA) Write

func (s *PATA) Write(fn byte, addr uint32, val byte) error

Jump to

Keyboard shortcuts

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