ztex

package module
v0.0.0-...-38ac715 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2017 License: MIT Imports: 4 Imported by: 0

README

ztex

Documentation

Overview

Package ztex manages ZTEX modules.

Index

Constants

View Source
const (
	// VendorID is the ZTEX USB vendor ID (VID).
	VendorID = gousb.ID(0x221A)

	// ProductID is the standard ZTEX USB product ID (PID)
	ProductID = gousb.ID(0x0100)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BitstreamCapacity

type BitstreamCapacity [2]byte

BitstreamCapacity indicates the maximum size of the FPGA bitstream in 4 kiB sectors.

func (BitstreamCapacity) Number

func (b BitstreamCapacity) Number() uint16

Number returns a raw numeric representation of the bitstream size.

func (BitstreamCapacity) String

func (b BitstreamCapacity) String() string

String returns a human-readable representation of the bitstream size.

type BitstreamConfig

type BitstreamConfig struct {
	BitstreamSize
	BitstreamCapacity
	BitstreamStart
}

BitstreamConfig indicates the configuration of the bitstream in flash.

func (BitstreamConfig) String

func (b BitstreamConfig) String() string

String returns a human-readable representation of the bitstream configuration.

type BitstreamSize

type BitstreamSize [2]byte

BitstreamSize indicates the actual size of the FPGA bitstream in 4 kiB sectors.

func (BitstreamSize) Number

func (b BitstreamSize) Number() uint16

Number returns a raw numeric representation of the bitstream size.

func (BitstreamSize) String

func (b BitstreamSize) String() string

String returns a human-readable representation of the bitstream size.

type BitstreamStart

type BitstreamStart [2]byte

BitstreamStart indicates the start of the bitstream.

func (BitstreamStart) Number

func (b BitstreamStart) Number() uint16

Number returns a raw numeric representation of the bitstream size.

func (BitstreamStart) String

func (b BitstreamStart) String() string

String returns a human-readable representation of the bitstream size.

type BoardConfig

type BoardConfig struct {
	BoardType
	BoardVersion
}

BoardConfig indicates the type, series, number, and variant of a ZTEX USB-FPGA module.

func (BoardConfig) String

func (b BoardConfig) String() string

String returns a human-readable representation of a board version.

type BoardNumber

type BoardNumber uint8

BoardNumber indicates a board in a series.

func (BoardNumber) Number

func (b BoardNumber) Number() uint8

Number returns the raw representation of a board number.

func (BoardNumber) String

func (b BoardNumber) String() string

String returns a human-readable description of a board number.

type BoardSeries

type BoardSeries uint8

BoardSeries indicates an entire generation of boards. Currently only Series 1 and Series 2 boards are supported.

func (BoardSeries) Number

func (b BoardSeries) Number() uint8

Number returns the raw representation of a board series.

func (BoardSeries) String

func (b BoardSeries) String() string

String returns a human-readable description of a board series.

type BoardType

type BoardType uint8

BoardType indicates the board type associated with the device.

func (BoardType) Number

func (b BoardType) Number() uint8

Number returns the raw representation of a board type.

func (BoardType) String

func (b BoardType) String() string

String returns a human-readable description of a board type.

type BoardVariant

type BoardVariant [2]byte

BoardVariant indicates a variation on a board series and number.

func (BoardVariant) Bytes

func (b BoardVariant) Bytes() []byte

Bytes returns the raw representation of a board variant.

func (BoardVariant) String

func (b BoardVariant) String() string

String returns a human-readable description of a board variant.

type BoardVersion

type BoardVersion struct {
	BoardSeries
	BoardNumber
	BoardVariant
}

BoardVersion indicates the series, number, and variant of a module.

func (BoardVersion) String

func (b BoardVersion) String() string

String returns a human-readable representation of the board version.

type DescriptorCapability

type DescriptorCapability [6]uint8

DescriptorCapability indicates the capabilities supported by the ZTEX device.

func (DescriptorCapability) DebugHelper

func (d DescriptorCapability) DebugHelper() bool

DebugHelper returns true if and only if the device has basic debug helper support.

func (DescriptorCapability) DebugHelper2

func (d DescriptorCapability) DebugHelper2() bool

DebugHelper2 returns true if and only if the device has advanced debug helper support.

func (DescriptorCapability) DefaultFirmware

func (d DescriptorCapability) DefaultFirmware() bool

DefaultFirmware returns true if and only if the device supports the default firmware interface.

func (DescriptorCapability) EEPROM

func (d DescriptorCapability) EEPROM() bool

EEPROM returns true if and only if the device has EEPROM support.

func (DescriptorCapability) FPGAConfiguration

func (d DescriptorCapability) FPGAConfiguration() bool

FPGAConfiguration returns true if and only if the device has basic FPGA configuration support.

func (DescriptorCapability) FX3Firmware

func (d DescriptorCapability) FX3Firmware() bool

FX3Firmware returns true if and only if the device has FX3 firmware support.

func (DescriptorCapability) FlashMemory

func (d DescriptorCapability) FlashMemory() bool

FlashMemory returns true if and only if the device has flash memory.

func (DescriptorCapability) FlashMemory2

func (d DescriptorCapability) FlashMemory2() bool

FlashMemory2 returns true if and only if the device has advanced flash memory support.

func (DescriptorCapability) HighSpeedFPGAConfiguration

func (d DescriptorCapability) HighSpeedFPGAConfiguration() bool

HighSpeedFPGAConfiguration returns true if and only if the device supports high-speed FPGA configuration.

func (DescriptorCapability) MACEEPROM

func (d DescriptorCapability) MACEEPROM() bool

MACEEPROM returns true if and only if the device has MAC EEPROM support.

func (DescriptorCapability) MultiFPGA

func (d DescriptorCapability) MultiFPGA() bool

MultiFPGA returns true if and only if the device has multi-FPGA support.

func (DescriptorCapability) String

func (d DescriptorCapability) String() string

String returns a human-readable description of the ZTEX capabilities supported by the device.

func (DescriptorCapability) TemperatureSensor

func (d DescriptorCapability) TemperatureSensor() bool

TemperatureSensor returns true if and only if the device has temperature sensor support.

func (DescriptorCapability) XMEGA

func (d DescriptorCapability) XMEGA() bool

XMEGA returns true if and only if the device has XMEGA support.

type DescriptorConfig

DescriptorConfig represents the ZTEX device descriptor.

func (DescriptorConfig) String

func (d DescriptorConfig) String() string

String returns a human-readable description of a ZTEX device descriptor.

type DescriptorFirmware

type DescriptorFirmware uint8

DescriptorFirmware indicates the version of the ZTEX firmware.

type DescriptorInterface

type DescriptorInterface uint8

DescriptorInterface indicates the version of the ZTEX interface.

type DescriptorMagic

type DescriptorMagic [4]uint8

DescriptorMagic indicates the presence of a ZTEX descriptor.

func (DescriptorMagic) Bytes

func (d DescriptorMagic) Bytes() []byte

Bytes returns a raw representation of the ZTEX magic bytes.

func (DescriptorMagic) String

func (d DescriptorMagic) String() string

String returns a human-readable description of the ZTEX magic bytes.

type DescriptorModule

type DescriptorModule [12]uint8

DescriptorModule represents product specific configuration.

type DescriptorProduct

type DescriptorProduct [4]uint8

DescriptorProduct represents a ZTEX product ID.

func (DescriptorProduct) Bytes

func (d DescriptorProduct) Bytes() []byte

Bytes returns a raw representation of the ZTEX product ID.

func (DescriptorProduct) String

func (d DescriptorProduct) String() string

String returns a human-readable description of the ZTEX product ID.

type DescriptorSerial

type DescriptorSerial [10]uint8

DescriptorSerial represents the device serial number.

func (DescriptorSerial) Bytes

func (d DescriptorSerial) Bytes() []byte

Bytes returns a raw representation of the device serial number.

func (DescriptorSerial) String

func (d DescriptorSerial) String() string

String returns a human-readable description of the device serial number.

type DescriptorSize

type DescriptorSize uint8

DescriptorSize represents the number of bytes in a ZTEX descriptor.

type DescriptorVersion

type DescriptorVersion uint8

DescriptorVersion represents the version of a ZTEX descriptor.

type Device

Device represents a ZTEX USB device.

func OpenDevice

func OpenDevice(ctx *gousb.Context, opt ...DeviceOption) (*Device, error)

OpenDevice opens a ZTEX USB-FPGA module and returns its device handle. If there are multiple modules present, then one is chosen arbitrarily.

func (*Device) FPGAStatus

func (d *Device) FPGAStatus() (*FPGAStatus, error)

FPGAStatus retrieves the current FPGA status.

func (*Device) FlashStatus

func (d *Device) FlashStatus() (*FlashStatus, error)

FlashStatus retrieves the current flash memory status.

func (*Device) ResetDefaultFirmware

func (d *Device) ResetDefaultFirmware() error

ResetDefaultFirmware resets the default firmware, if it is present.

func (*Device) ResetFPGA

func (d *Device) ResetFPGA() error

ResetFPGA resets the FPGA on the device.

func (*Device) ResetFX3

func (d *Device) ResetFX3() error

ResetFX3 resets the Cypress CYUSB3033 EZ-USB FX3S controller on the device, if one is present.

func (*Device) String

func (d *Device) String() string

String returns a human-readable representation of the device.

type DeviceOption

type DeviceOption func(*Device) error

DeviceOption represents a device option.

func ControlTimeout

func ControlTimeout(timeout time.Duration) DeviceOption

ControlTimeout sets the timeout for control commands for the device.

type FPGAChecksum

type FPGAChecksum uint8

FPGAChecksum represents the number of bytes

type FPGAConfig

type FPGAConfig struct {
	FPGAType
	FPGAPackage
	FPGAGrade
}

FPGAConfig indicates the type, package, speed grade, etc. of the FPGA present in a device.

func (FPGAConfig) String

func (f FPGAConfig) String() string

String returns a human-readable representation of the FPGA version.

type FPGAConfigured

type FPGAConfigured uint8

FPGAConfigured indicates whether or not the FPGA is configured.

func (FPGAConfigured) Bool

func (f FPGAConfigured) Bool() bool

Bool returns true if and only if the FPGA is configured.

func (FPGAConfigured) Number

func (f FPGAConfigured) Number() uint8

Number returns the raw numeric representation of the FPGA configuration indicator.

func (FPGAConfigured) String

func (f FPGAConfigured) String() string

String returns a human-readable description of the FPGA configuration indicator.

type FPGAGrade

type FPGAGrade [3]byte

FPGAGrade indicates the speed grade, operating voltages, and temperature range of the FPGA.

func (FPGAGrade) Bytes

func (f FPGAGrade) Bytes() []byte

Bytes returns the raw representation of the FPGA grade.

func (FPGAGrade) String

func (f FPGAGrade) String() string

String returns a human-readable representation of the FPGA grade.

type FPGAInit

type FPGAInit uint8

FPGAInit represents the number of INIT_B states.

type FPGAPackage

type FPGAPackage uint8

FPGAPackage indicates the mechanical packaging of the FPGA.

func (FPGAPackage) Number

func (f FPGAPackage) Number() uint8

Number returns the raw numeric representation of an FPGA package.

func (FPGAPackage) String

func (f FPGAPackage) String() string

String returns a human-readable representation of the FPGA package.

type FPGAResult

type FPGAResult uint8

FPGAResult represents the result of previous FPGA configuration.

func (FPGAResult) Bool

func (f FPGAResult) Bool() bool

Bool returns true if and only if the result indicates that configuration was successful.

func (FPGAResult) String

func (f FPGAResult) String() string

String returns a human-readable description of the FPGA configuration result.

type FPGAStatus

FPGAStatus indicates the status of the FPGA.

func (FPGAStatus) String

func (f FPGAStatus) String() string

String returns a human-readable description of the FPGA status.

type FPGASwapped

type FPGASwapped uint8

FPGASwapped represents the bit order of the FPGA bitstream.

func (FPGASwapped) Bool

func (f FPGASwapped) Bool() bool

Bool returns true if and only if the bitstream bit order is swapped.

func (FPGASwapped) Number

func (f FPGASwapped) Number() uint8

Number returns the raw numeric representation of the bitstream bit order.

func (FPGASwapped) String

func (f FPGASwapped) String() string

String returns a human-readable description of the bitstream bit order.

type FPGATransferred

type FPGATransferred [4]uint8

FPGATransferred represents the number of bytes transferred.

func (FPGATransferred) Number

func (f FPGATransferred) Number() uint32

Number returns the number of bytes transferred.

func (FPGATransferred) String

func (f FPGATransferred) String() string

String returns a human-readable description of the number of bytes transferred.

type FPGAType

type FPGAType [2]byte

FPGAType indicates which FPGA device is present.

func (FPGAType) Bytes

func (f FPGAType) Bytes() []byte

Bytes returns a raw representation of an FPGA type.

func (FPGAType) Number

func (f FPGAType) Number() uint16

Number returns a numeric representation of an FPGA type.

func (FPGAType) String

func (f FPGAType) String() string

String returns a human-readable representation of an FPGA type.

type FlashCount

type FlashCount [4]uint8

FlashCount represents the number of sectors in the flash.

func (FlashCount) Number

func (f FlashCount) Number() uint32

Number returns the number of sectors in the flash.

func (FlashCount) String

func (f FlashCount) String() string

String returns a human-readable description of the number of sectors in the flash.

type FlashEnabled

type FlashEnabled uint8

FlashEnabled indicates whether or not the flash is enabled.

func (FlashEnabled) String

func (f FlashEnabled) String() string

String returns a human-readable description of whether or not the flash is enabled.

type FlashError

type FlashError uint8

FlashError represents the error code in the flash.

func (FlashError) String

func (f FlashError) String() string

String returns a human-readable description of the flash error code.

type FlashSector

type FlashSector [2]uint8

FlashSector represents the size of a sector in the flash.

func (FlashSector) Number

func (f FlashSector) Number() uint64

Number returns the size of a sector in the flash (in bytes).

func (FlashSector) String

func (f FlashSector) String() string

String returns a human-readable description of the size of a sector in the flash.

type FlashStatus

type FlashStatus struct {
	FlashEnabled
	FlashSector
	FlashCount
	FlashError
}

FlashStatus indicates the current status of the flash.

func (FlashStatus) String

func (f FlashStatus) String() string

String returns a human-readable description of the flash status.

type RAMConfig

type RAMConfig struct {
	RAMSize
	RAMType
}

RAMConfig indicates the size and type of the RAM in the module.

func (RAMConfig) String

func (r RAMConfig) String() string

String returns a human-readable representation of the RAM configuration.

type RAMSize

type RAMSize uint8

RAMSize indicates the amount of RAM available on the module.

func (RAMSize) Number

func (r RAMSize) Number() uint8

Number returns a raw numeric representation of the RAM size.

func (RAMSize) String

func (r RAMSize) String() string

String returns a human-readable representation of the RAM size.

type RAMType

type RAMType uint8

RAMType indicates the type of RAM available on the module.

func (RAMType) String

func (r RAMType) String() string

String returns a human-readable representation of the RAM type.

Jump to

Keyboard shortcuts

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