sdp

package
v0.0.0-...-da8589f Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package sdp provide helpers for implementing the Serial Download Protocol (SDP), used on NXP i.MX System-on-Chip (SoC) application processors.

Index

Constants

View Source
const (
	TagIVT = 0xd1
	TagDCD = 0xd2
)

Program image tags (p309, 8.7 Program image, IMX6ULLRM).

View Source
const (
	// write command tag
	WriteData = 0xcc
	// DCD pointer offset within IVT
	DCDOffset = 12
	// maximum DCD size
	DCDSize = 1768
)

DCD constants (p312, 8.7.2 Device Configuration Data (DCD), IMX6ULLRM).

View Source
const (
	ReadRegister  = 0x0101
	WriteFile     = 0x0404
	DCDWrite      = 0x0a0a
	JumpAddress   = 0x0b0b
	SkipDCDHeader = 0x0c0c
)

SDP command types (p322, 8.9.3 Serial Download Protocol (SDP), IMX6ULLRM).

View Source
const HIDReportSize = 1024

Variables

This section is empty.

Functions

func BuildDCDWriteReport

func BuildDCDWriteReport(dcd []byte, addr uint32) (r1 []byte, r2 []byte)

BuildDCDWriteReport generates USB HID reports (IDs 1 and 2) that implement the SDP DCD_WRITE command sequence, used to load a DCD binary payload (p327, 8.9.3.1.5 DCD_WRITE, IMX6ULLRM).

func BuildFileWriteReport

func BuildFileWriteReport(imx []byte, addr uint32) (r1 []byte, r2 [][]byte)

BuildFileWriteReport generates USB HID reports (IDs1 and 2) that implement the SDP FILE_WRITE command sequence, used to load an imx binary payload (p325, 8.9.3.1.3 FILE_WRITE, IMX6ULLRM).

func BuildJumpAddressReport

func BuildJumpAddressReport(addr uint32) (r1 []byte)

BuildJumpAddressReport generates the USB HID report (ID 1) that implements the SDP JUMP_ADDRESS command, used to execute an imx binary payload (p328, 8.9.3.1.7 JUMP_ADDRESS, IMX6ULLRM).

func BuildReadRegisterReport

func BuildReadRegisterReport(addr uint32, size uint32) (r1 []byte)

BuildReadRegisterReport generates USB HID reports (ID 1) that implement the SDP READ_REGISTER command for reading a single 32-bit device register value (p323, 8.9.3.1.1 READ_REGISTER, IMX6ULLRM).

func ParseDCD

func ParseDCD(imx []byte, ivt *IVT) (dcd []byte, err error)

ParseDCD extracts the Device Configuration Data (DCD) from an imx format binary image.

Types

type DCDHeader

type DCDHeader struct {
	Tag     uint8
	Length  uint16
	Version uint8
}

DCDHeader represents a DCD header (p312, 8.7.2 Device Configuration Data (DCD), IMX6ULLRM).

type IVT

type IVT struct {
	Tag     uint8
	Length  uint16
	Version uint8
	Entry   uint32

	DCD      uint32
	BootData uint32
	Self     uint32
	CSF      uint32
	// contains filtered or unexported fields
}

IVT represents an IVT entry (p311, 8.7.1.1 Image vector table structure, IMX6ULLRM).

func ParseIVT

func ParseIVT(imx []byte) (ivt *IVT, err error)

ParseIVT extracts the Image Vector Table (IVT) from an imx format binary image.

type SDP

type SDP struct {
	CommandType uint16
	Address     uint32
	Format      uint8
	DataCount   uint32
	Data        uint32
	// contains filtered or unexported fields
}

SDP represents an SDP command (p322, 8.9.3 Serial Download Protocol (SDP), IMX6ULLRM).

func (*SDP) Bytes

func (s *SDP) Bytes() []byte

Bytes converts the SDP command structure to byte array format.

Jump to

Keyboard shortcuts

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