io

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func In

func In(addr uint16, data UintN) error

In reads data from the x86 port at address addr. Data must be Uint8, Uint16, Uint32, but not Uint64.

Example
var data Uint8
if err := In(0x3f8, &data); err != nil {
	log.Fatal(err)
}
fmt.Printf("%v\n", data)
Output:

func Out

func Out(addr uint16, data UintN) error

Out writes data to the x86 port at address addr. data must be Uint8, Uint16 uint32, but not Uint64.

Example
data := Uint8('A')
if err := Out(0x3f8, &data); err != nil {
	log.Fatal(err)
}
Output:

func Read

func Read(addr int64, data UintN) error

Read reads data from physical memory at address addr. On x86 platforms, this uses the seek+read syscalls. On arm platforms, this uses mmap.

Example
var data Uint32
if err := Read(0x1000000, &data); err != nil {
	log.Fatal(err)
}
log.Printf("%v\n", data)
Output:

func Write

func Write(addr int64, data UintN) error

Write writes data to physical memory at address addr. On x86 platforms, this uses the seek+read syscalls. On arm platforms, this uses mmap.

Example
data := Uint32(42)
if err := Write(0x1000000, &data); err != nil {
	log.Fatal(err)
}
Output:

Types

type Uint16

type Uint16 uint16

Uint16 is a wrapper around uint16.

func (*Uint16) Size

func (u *Uint16) Size() int64

Size of uint16 is 2.

func (*Uint16) String

func (u *Uint16) String() string

String formats a uint16 in hex.

type Uint32

type Uint32 uint32

Uint32 is a wrapper around uint32.

func (*Uint32) Size

func (u *Uint32) Size() int64

Size of uint32 is 4.

func (*Uint32) String

func (u *Uint32) String() string

String formats a uint32 in hex.

type Uint64

type Uint64 uint64

Uint64 is a wrapper around uint64.

func (*Uint64) Size

func (u *Uint64) Size() int64

Size of uint64 is 8.

func (*Uint64) String

func (u *Uint64) String() string

String formats a uint64 in hex.

type Uint8

type Uint8 uint8

Uint8 is a wrapper around uint8.

func (*Uint8) Size

func (u *Uint8) Size() int64

Size of uint8 is 1.

func (*Uint8) String

func (u *Uint8) String() string

String formats a uint8 in hex.

type UintN

type UintN interface {
	// Return size in bytes.
	Size() int64

	// Return string formatted in hex.
	String() string
	// contains filtered or unexported methods
}

UintN is a wrapper around uint types and provides a few io-related functions.

Jump to

Keyboard shortcuts

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