protocol

package
v0.0.0-...-51e30aa Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT Copyright (c) 2021 Brian Starkey <stark3y@gmail.com>

Index

Constants

This section is empty.

Variables

View Source
var (
	OpcodeSync       [4]byte = [4]byte{'S', 'Y', 'N', 'C'}
	OpcodeRead       [4]byte = [4]byte{'R', 'E', 'A', 'D'}
	OpcodeCsum       [4]byte = [4]byte{'C', 'S', 'U', 'M'}
	OpcodeCRC        [4]byte = [4]byte{'C', 'R', 'C', 'C'}
	OpcodeErase      [4]byte = [4]byte{'E', 'R', 'A', 'S'}
	OpcodeWrite      [4]byte = [4]byte{'W', 'R', 'I', 'T'}
	OpcodeSeal       [4]byte = [4]byte{'S', 'E', 'A', 'L'}
	OpcodeGo         [4]byte = [4]byte{'G', 'O', 'G', 'O'}
	OpcodeInfo       [4]byte = [4]byte{'I', 'N', 'F', 'O'}
	ResponseSync     [4]byte = [4]byte{'P', 'I', 'C', 'O'}
	ResponseSyncWota [4]byte = [4]byte{'W', 'O', 'T', 'A'}
	ResponseOK       [4]byte = [4]byte{'O', 'K', 'O', 'K'}
	ResponseErr      [4]byte = [4]byte{'E', 'R', 'R', '!'}
)
View Source
var ErrNotSynced error = errors.New("not synced")

Functions

This section is empty.

Types

type CRCCommand

type CRCCommand struct {
	Addr uint32
	Len  uint32
	CRC  uint32
}

func (*CRCCommand) Execute

func (c *CRCCommand) Execute(rw io.ReadWriter) error

type CsumCommand

type CsumCommand struct {
	Addr uint32
	Len  uint32
	Csum uint32
}

func (*CsumCommand) Execute

func (c *CsumCommand) Execute(rw io.ReadWriter) error

type EraseCommand

type EraseCommand struct {
	Addr uint32
	Len  uint32
}

func (*EraseCommand) Execute

func (c *EraseCommand) Execute(rw io.ReadWriter) error

type GoCommand

type GoCommand struct {
	Addr uint32
}

func (*GoCommand) Execute

func (c *GoCommand) Execute(rw io.ReadWriter) error

type InfoCommand

type InfoCommand struct {
	FlashAddr  uint32
	FlashSize  uint32
	EraseSize  uint32
	WriteSize  uint32
	MaxDataLen uint32
}

func (*InfoCommand) Execute

func (c *InfoCommand) Execute(rw io.ReadWriter) error

type ReadCommand

type ReadCommand struct {
	Addr uint32
	Len  uint32
	Data []byte
}

func (*ReadCommand) Execute

func (c *ReadCommand) Execute(rw io.ReadWriter) error

type SealCommand

type SealCommand struct {
	Addr uint32
	Len  uint32
	CRC  uint32
}

func NewSealCommand

func NewSealCommand(addr uint32, data []byte) *SealCommand

func (*SealCommand) Execute

func (c *SealCommand) Execute(rw io.ReadWriter) error

type SyncCommand

type SyncCommand struct {
}

func (*SyncCommand) Execute

func (c *SyncCommand) Execute(rw io.ReadWriter) error

type WriteCommand

type WriteCommand struct {
	Addr uint32
	Len  uint32
	Data []byte
}

func (*WriteCommand) Execute

func (c *WriteCommand) Execute(rw io.ReadWriter) error

Jump to

Keyboard shortcuts

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