dfu

package
v0.0.0-...-6437eea Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(usb *gousb.Device) error

func ClearStatus

func ClearStatus(usb *gousb.Device) error

func SendChunk

func SendChunk(usb *gousb.Device, c []byte, blockno uint16) error

func SendImage

func SendImage(usb *gousb.Device, i []byte, version ProtoVersion) error

Types

type Err

type Err uint8
const (
	ErrOk          Err = 0x00
	ErrTarget      Err = 0x01
	ErrFile        Err = 0x02
	ErrWrite       Err = 0x03
	ErrErase       Err = 0x04
	ErrCheckErased Err = 0x05
	ErrProg        Err = 0x06
	ErrVerify      Err = 0x07
	ErrAddress     Err = 0x08
	ErrNotDone     Err = 0x09
	ErrFirmware    Err = 0x0a
	ErrVendor      Err = 0x0b
	ErrUsbr        Err = 0x0c
	ErrPor         Err = 0x0d
	ErrUnknown     Err = 0x0e
	ErrStalledPkt  Err = 0x0f
)

type ProtoVersion

type ProtoVersion int
const (
	// ProtoVersion1 is implemented by Nano3G.
	ProtoVersion1 ProtoVersion = 1
	// ProtoVersion2 is implemented by Nano4G+.
	ProtoVersion2 ProtoVersion = 2
)

type Request

type Request uint8
const (
	RequestDetach    Request = 0
	RequestDnload    Request = 1
	RequestUpload    Request = 2
	RequestGetStatus Request = 3
	RequestClrStatus Request = 4
	RequestGetState  Request = 5
	RequestAbort     Request = 6
)

type State

type State uint8
const (
	StateAppIdle           State = 0
	StateAppDetach         State = 1
	StateIdle              State = 2
	StateDnloadSync        State = 3
	StateDnBusy            State = 4
	StateDnloadIdle        State = 5
	StateManifestSync      State = 6
	StateManifest          State = 7
	StateManifestWaitReset State = 8
	StateUploadIdle        State = 9
	StateError             State = 10
)

func GetState

func GetState(usb *gousb.Device) (State, error)

func (State) String

func (d State) String() string

type Status

type Status struct {
	Err     Err
	State   State
	Timeout time.Duration
}

func GetStatus

func GetStatus(usb *gousb.Device) (*Status, error)

Jump to

Keyboard shortcuts

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