Documentation
¶
Overview ¶
Package ztex manages ZTEX modules.
Index ¶
- Constants
- type BitstreamCapacity
- type BitstreamConfig
- type BitstreamSize
- type BitstreamStart
- type BoardConfig
- type BoardNumber
- type BoardSeries
- type BoardType
- type BoardVariant
- type BoardVersion
- type DescriptorCapability
- func (d DescriptorCapability) DebugHelper() bool
- func (d DescriptorCapability) DebugHelper2() bool
- func (d DescriptorCapability) DefaultFirmware() bool
- func (d DescriptorCapability) EEPROM() bool
- func (d DescriptorCapability) FPGAConfiguration() bool
- func (d DescriptorCapability) FX3Firmware() bool
- func (d DescriptorCapability) FlashMemory() bool
- func (d DescriptorCapability) FlashMemory2() bool
- func (d DescriptorCapability) HighSpeedFPGAConfiguration() bool
- func (d DescriptorCapability) MACEEPROM() bool
- func (d DescriptorCapability) MultiFPGA() bool
- func (d DescriptorCapability) String() string
- func (d DescriptorCapability) TemperatureSensor() bool
- func (d DescriptorCapability) XMEGA() bool
- type DescriptorConfig
- type DescriptorFirmware
- type DescriptorInterface
- type DescriptorMagic
- type DescriptorModule
- type DescriptorProduct
- type DescriptorSerial
- type DescriptorSize
- type DescriptorVersion
- type Device
- type DeviceOption
- type FPGAChecksum
- type FPGAConfig
- type FPGAConfigured
- type FPGAGrade
- type FPGAInit
- type FPGAPackage
- type FPGAResult
- type FPGAStatus
- type FPGASwapped
- type FPGATransferred
- type FPGAType
- type FlashCount
- type FlashEnabled
- type FlashError
- type FlashSector
- type FlashStatus
- type RAMConfig
- type RAMSize
- type RAMType
Constants ¶
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.
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 ¶
type DescriptorConfig struct {
DescriptorSize
DescriptorVersion
DescriptorMagic
DescriptorProduct
DescriptorFirmware
DescriptorInterface
DescriptorCapability
DescriptorModule
DescriptorSerial
}
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 ¶
type Device struct {
*gousb.Device
DescriptorConfig
BoardConfig
FPGAConfig
RAMConfig
BitstreamConfig
}
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 ¶
ResetDefaultFirmware resets the default firmware, if it is present.
type DeviceOption ¶
DeviceOption represents a device option.
func ControlTimeout ¶
func ControlTimeout(timeout time.Duration) DeviceOption
ControlTimeout sets the timeout for control commands for the device.
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.
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 ¶
type FPGAStatus struct {
FPGAConfigured
FPGAChecksum
FPGATransferred
FPGAInit
FPGAResult
FPGASwapped
}
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.
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.