|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectztex.Ztex1
ztex.Ztex1v1
public class Ztex1v1
This class implements the communication protocol of the interface version 1 for the interaction with the ZTEX firmware.
The features supported by this interface can be accessed via vendor commands and vendor requests via Endpoint 0.
Each feature can be enabled or disabled by the firmware and also depends from the hardware.
The presence of a feature is indicated by a 1 in the corresponding feature bit of the ZTEX descriptor 1, see ZtexDevice1
.
The following table gives an overview about the features
Capability bit | Description | |||||||||||||||||||||||||
0.0 |
EEPROM support
|
|||||||||||||||||||||||||
0.1 |
FPGA Configuration
|
|||||||||||||||||||||||||
0.2 |
Flash memory support
|
|||||||||||||||||||||||||
0.3 |
Debug helper support
|
|||||||||||||||||||||||||
0.4 |
XMEGA support
|
|||||||||||||||||||||||||
0.5 |
High speed FPGA configuration support
|
|||||||||||||||||||||||||
0.6 |
MAC EEPROM support
|
|||||||||||||||||||||||||
0.7 |
Multi-FPGA support
|
|||||||||||||||||||||||||
1.0 |
Temperature sensor support
|
|||||||||||||||||||||||||
1.1 |
Flash 2 support
|
ZtexDevice1
,
Ztex1
Field Summary | |
---|---|
static int |
CAPABILITY_DEBUG
Capability index for DEBUG helper support. |
static int |
CAPABILITY_EEPROM
Capability index for EEPROM support. |
static int |
CAPABILITY_FLASH
Capability index for FLASH memory support. |
static int |
CAPABILITY_FLASH2
Capability index for 2nd FLASH memory support. |
static int |
CAPABILITY_FPGA
Capability index for FPGA configuration support. |
static int |
CAPABILITY_HS_FPGA
Capability index for AVR XMEGA support. |
static int |
CAPABILITY_MAC_EEPROM
Capability index for AVR XMEGA support. |
static int |
CAPABILITY_MULTI_FPGA
Capability index for multi FPGA support |
static int |
CAPABILITY_TEMP_SENSOR
Capability index for Temperature sensor support |
static int |
CAPABILITY_XMEGA
Capability index for AVR XMEGA support. |
static java.lang.String[] |
capabilityStrings
The names of the capabilities |
ConfigData |
config
The configuration data structure is initialized if this kind of data is present in MAC EEPROM. |
int |
debugNewMessages
Is set by debugReadMessages(boolean,byte[]) and contains the number of new messages. |
int |
eepromBytes
Number of bytes written to EEPROM. |
int |
eepromChecksum
Checksum of the last EEPROM transfer. |
boolean |
enableExtraFpgaConfigurationChecks
Enables extra FPGA configuration checks. |
static int |
FLASH_EC_BUSY
Signals that Flash memory it busy. |
static int |
FLASH_EC_CMD_ERROR
Signals an error while attempting to execute a command. |
static int |
FLASH_EC_NO_ERROR
Means no error. |
static int |
FLASH_EC_NOTSUPPORTED
Signals the the installed Flash memory is not supported. |
static int |
FLASH_EC_PENDING
Signals that another Flash operation is pending. |
static int |
FLASH_EC_READ_ERROR
Signals an error while attempting to read from Flash. |
static int |
FLASH_EC_TIMEOUT
Signals that a timeout occurred. |
static int |
FLASH_EC_WRITE_ERROR
Signals an error while attempting to write to Flash. |
int |
flash2EC
Last 2nd Flash error code obtained by flashState() . |
int |
flashEC
Last Flash error code obtained by flashState() . |
int |
tempSensorUpdateInterval
smallest temperature sensor update interval in ms |
static int |
XMEGA_EC_ADDRESS_ERROR
Signals an address error (invalid address or wrong page size). |
static int |
XMEGA_EC_INVALID_DEVICE
Signals that the ATxmega controller is not supported. |
static int |
XMEGA_EC_NO_ERROR
Means no error. |
static int |
XMEGA_EC_NVM_BUSY
Signals that the NVM is busy. |
static int |
XMEGA_EC_NVM_TIMEOUT
Signals that an NVM timeout occurred. |
static int |
XMEGA_EC_PDI_READ_ERROR
Signals a PDI read error. |
int |
xmegaEC
Last ATxmega error code obtained by xmegaState() . |
Fields inherited from class ztex.Ztex1 |
---|
certainWorkarounds, controlMsgTimeout |
Constructor Summary | |
---|---|
Ztex1v1(ZtexDevice1 pDev)
Constructs an instance from a given device. |
Method Summary | |
---|---|
java.lang.String |
capabilityInfo(java.lang.String pf)
Creates a String with capability information. |
void |
checkCapability(int i)
Checks whether ZTEX descriptor 1 is available and interface 1 and a given capability are supported. |
void |
checkCapability(int i,
int j)
Checks whether ZTEX descriptor 1 is available and interface 1 and a given capability are supported. |
void |
checkCompatible(int productId0,
int productId1,
int productId2,
int productId3)
Checks whether the given product ID is compatible to the device corresponding to this class and whether interface 1 is supported. |
void |
checkValid()
Checks whether ZTEX descriptor 1 is available and interface 1 is supported. |
boolean |
compatible(int productId0,
int productId1,
int productId2,
int productId3)
Checks whether the given product ID is compatible to the device corresponding to this class and whether interface 1 is supported. |
long |
configureFpga(java.io.InputStream inputStream,
boolean force,
int bs)
Upload a Bitstream to the FPGA using high speed mode (if available) or low speed mode. |
long |
configureFpga(java.lang.String fwFileName,
boolean force)
Upload a Bitstream to the FPGA using high speed mode (if available) or low speed mode. |
long |
configureFpga(java.lang.String fwFileName,
boolean force,
int bs)
Upload a Bitstream to the FPGA using high speed mode (if available) or low speed mode. |
long |
configureFpgaHS(java.io.InputStream inputStream,
boolean force,
int bs)
Upload a Bitstream to the FPGA using high speed mode. |
long |
configureFpgaHS(java.lang.String fwFileName,
boolean force,
int bs)
Upload a Bitstream to the FPGA using high speed mode. |
long |
configureFpgaLS(java.io.InputStream inputStream,
boolean force,
int bs)
Upload a Bitstream to the FPGA using low speed mode. |
long |
configureFpgaLS(java.lang.String fwFileName,
boolean force,
int bs)
Upload a Bitstream to the FPGA using low speed mode. |
int |
debugLastMsg()
Returns the number of the last message read out by debugReadMessages(boolean,byte[]) |
int |
debugMsgSize()
Returns the size of messages in bytes. |
int |
debugReadMessages(boolean all,
byte[] buf)
Reads debug messages from message stack. |
int |
debugStackSize()
Returns the size of message stack in messages. |
void |
eepromDisable()
Disables the firmware stored in the EEPROM. |
void |
eepromRead(int addr,
byte[] buf,
int length)
Reads data from the EEPROM. |
boolean |
eepromState()
Reads the current EEPROM status. |
long |
eepromUpload(java.lang.String ihxFileName,
boolean force)
Upload the firmware to the EEPROM. |
long |
eepromUpload(ZtexIhxFile1 ihxFile,
boolean force)
Upload the firmware to the EEPROM. |
void |
eepromWrite(int addr,
byte[] buf,
int length)
Writes data to the EEPROM. |
boolean |
flash2Enabled()
Returns true if 2nd Flash memory is installed. |
java.lang.String |
flash2Info()
Returns information about 2nd Flash memory. |
void |
flash2ReadSector(int sector,
byte[] buf)
Reads one sector from the 2nd Flash memory. |
void |
flash2ReadSector(int sector,
int num,
byte[] buf)
Reads a integer number of sectors from the 2nd Flash memory. |
int |
flash2Sectors()
Returns the number of sectors of the 2nd Flash memory or 0, if no 2nd Flash is installed. |
int |
flash2SectorSize()
Returns the sector size of the 2nd Flash memory or 0, if no 2nd Flash is installed. |
long |
flash2Size()
Returns the size of 2nd Flash memory or 0, if no 2nd Flash memory is installed. |
boolean |
flash2State()
Reads the the 2nd Flash memory status and information. |
java.lang.String |
flash2StrError()
Gets the last 2nd Flash error from the device. |
void |
flash2WriteSector(int sector,
byte[] buf)
Writes one sector to the 2nd Flash memory. |
void |
flash2WriteSector(int sector,
int num,
byte[] buf)
Writes a integer number of sectors to the 2nd Flash. |
boolean |
flashEnabled()
Returns true if Flash memory is installed. |
int |
flashFirstFreeSector()
Returns the first free sector of the Flash memory. |
java.lang.String |
flashInfo()
Returns information about Flash memory. |
void |
flashReadSector(int sector,
byte[] buf)
Reads one sector from the Flash. |
void |
flashReadSector(int sector,
int num,
byte[] buf)
Reads a integer number of sectors from the Flash. |
void |
flashResetBitstream()
Clears a Bitstream from the Flash. |
int |
flashSectors()
Returns the number of sectors of the Flash memory or 0, if no Flash memory is installed. |
int |
flashSectorSize()
Returns the sector size of the Flash memory or 0, if no Flash is installed. |
long |
flashSize()
Returns the size of Flash memory or 0, if no Flash memory is installed. |
boolean |
flashState()
Reads the the Flash memory status and information. |
java.lang.String |
flashStrError()
Gets the last Flash error from the device. |
static java.lang.String |
flashStrError(int errNum)
Converts a given error code into a String. |
long |
flashUploadBitstream(java.io.InputStream inputStream,
int bs)
Uploads a Bitstream to the Flash. |
long |
flashUploadBitstream(java.lang.String fwFileName)
Uploads a Bitstream to the Flash. |
long |
flashUploadBitstream(java.lang.String fwFileName,
int bs)
Uploads a Bitstream to the Flash. |
void |
flashWriteSector(int sector,
byte[] buf)
Writes one sector to the Flash. |
void |
flashWriteSector(int sector,
int num,
byte[] buf)
Writes a integer number of sectors to the Flash. |
int |
getFlash2EC()
Gets the last 2nd Flash memory error from the device. |
int |
getFlashEC()
Gets the last Flash error from the device. |
boolean |
getFpgaConfiguration()
Returns true if the FPGA is configured. |
java.lang.String |
getFpgaConfigurationStr()
Returns a string that indicates the FPGA configuration status. |
protected void |
init()
Initializates the class. |
boolean |
InterfaceCapabilities(int i)
Returns interface capability bit. |
void |
macEepromRead(int addr,
byte[] buf,
int length)
Reads data from the MAC EEPROM. |
boolean |
macEepromState()
Reads the current MAC EEPROM status. |
void |
macEepromWrite(int addr,
byte[] buf,
int length)
Writes data to the MAC EEPROM. |
void |
macRead(byte[] buf)
Reads MAC address from MAC EEPROM. |
int |
numberOfFpgas()
Returns the number of FPGA's |
void |
printFpgaState()
Prints out the FPGA state. |
boolean |
printMmc2State()
Prints out some debug information about *SD/MMC Flash cards in SPI mode. |
boolean |
printMmcState()
Prints out some debug information about *SD/MMC Flash cards in SPI mode. |
boolean |
printSpiState()
Prints out some debug information about SPI Flash. |
void |
resetFpga()
Resets the FPGA. |
void |
selectFpga(int num)
Select a FPGA |
double |
tempSensorRead(int idx)
Read temperature sensor data. |
java.lang.String |
toString()
Returns a lot of useful information about the corresponding device. |
boolean |
valid()
Returns true if ZTEX interface 1 is available. |
boolean |
valid(int i,
int j)
Returns true if ZTEX interface 1 and capability i.j are available. |
int |
xmegaEepromPages()
Returns the number of the ATxmega EEPROM pages. |
int |
xmegaEepromPageSize()
Returns the size of the ATXmega EEPROM pages. |
void |
xmegaEepromPageWrite(int addr,
byte[] buf)
Writes data to EEPROM memory of ATxmega. |
void |
xmegaEepromRead(int addr,
byte[] buf,
int length)
Reads data from EEPROM memory of ATxmega. |
boolean |
xmegaEnabled()
Returns true if ATxmega controller is available. |
int |
xmegaFlashPages()
Returns the number of the ATxmega Flash pages. |
int |
xmegaFlashPageSize()
Returns the size of the ATxmega Flash pages. |
void |
xmegaFlashPageWrite(int addr,
byte[] buf)
Writes data to Flash memory of ATxmega. |
void |
xmegaFlashRead(int addr,
byte[] buf,
int length)
Reads data from Flash memory of ATxmega. |
int |
xmegaFuseRead(int addr)
Reads data one Fuse of ATxmega. |
void |
xmegaFuseRead(int addr,
byte[] buf,
int length)
Reads data from Fuse memory of ATxmega. |
void |
xmegaFuseWrite(int addr,
int val)
Writes one Fuse of the ATxmega. |
void |
xmegaNvmRead(int addr,
byte[] buf,
int length)
Reads data from the NVM of ATxmega. |
void |
xmegaReset()
Resets the ATxmega. |
int |
xmegaState()
Read ATxmega error and status information from the device. |
java.lang.String |
xmegaStrError()
Gets the last ATxmega error from the device. |
java.lang.String |
xmegaStrError(int errNum)
Converts a given error code into a String. |
long |
xmegaWriteEeprom(IhxFile ihxFile)
Uploads data to the EEPROM memory |
long |
xmegaWriteFirmware(IhxFile ihxFile)
Uploads firmware to the flash memory |
Methods inherited from class ztex.Ztex1 |
---|
claimInterface, dev, finalize, getInterfaceClaimed, handle, releaseInterface, resetEzUsb, setConfiguration, trySetConfiguration, uploadFirmware, uploadFirmware, uploadFirmware, vendorCommand, vendorCommand, vendorCommand, vendorCommand2, vendorRequest, vendorRequest, vendorRequest2, vendorRequest2 |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CAPABILITY_EEPROM
public static final int CAPABILITY_FPGA
public static final int CAPABILITY_FLASH
public static final int CAPABILITY_DEBUG
public static final int CAPABILITY_XMEGA
public static final int CAPABILITY_HS_FPGA
public static final int CAPABILITY_MAC_EEPROM
public static final int CAPABILITY_MULTI_FPGA
public static final int CAPABILITY_TEMP_SENSOR
public static final int CAPABILITY_FLASH2
public static final java.lang.String[] capabilityStrings
public boolean enableExtraFpgaConfigurationChecks
public int eepromBytes
eepromState()
.)
public int eepromChecksum
eepromState()
.)
public int flashEC
flashState()
. See FLASH_EC_* for possible error codes.
public int flash2EC
flashState()
. See FLASH_EC_* for possible error codes.
public static final int FLASH_EC_NO_ERROR
public static final int FLASH_EC_CMD_ERROR
public static final int FLASH_EC_TIMEOUT
public static final int FLASH_EC_BUSY
public static final int FLASH_EC_PENDING
public static final int FLASH_EC_READ_ERROR
public static final int FLASH_EC_WRITE_ERROR
public static final int FLASH_EC_NOTSUPPORTED
public int debugNewMessages
debugReadMessages(boolean,byte[])
and contains the number of new messages.
public int xmegaEC
xmegaState()
. See XMEGA_EC_* for possible error codes.
public static final int XMEGA_EC_NO_ERROR
public static final int XMEGA_EC_PDI_READ_ERROR
public static final int XMEGA_EC_NVM_TIMEOUT
public static final int XMEGA_EC_INVALID_DEVICE
public static final int XMEGA_EC_ADDRESS_ERROR
public static final int XMEGA_EC_NVM_BUSY
public int tempSensorUpdateInterval
public ConfigData config
macEepromWrite(int,byte[],int)
.
In order to override this behavior set this variable to null.
If no configuration data is present config
is null.
Constructor Detail |
---|
public Ztex1v1(ZtexDevice1 pDev) throws UsbException
pDev
- The given device.
UsbException
- if an communication error occurred.Method Detail |
---|
protected void init() throws UsbException
init
in class Ztex1
UsbException
- if an communication error occurred.public boolean valid()
valid
in class Ztex1
public boolean valid(int i, int j)
i
- byte index of the capabilityj
- bit index of the capability
public boolean compatible(int productId0, int productId1, int productId2, int productId3)
if ( this.productId(0)==0 || productId0<=0 || this.productId(0)==productId0 ) && ( this.productId(0)==0 || productId1<=0 || this.productId(1)==productId1 ) && ( this.productId(2)==0 || productId2<=0 || this.productId(2)==productId2 ) && ( this.productId(3)==0 || productId3<=0 || this.productId(3)==productId3 )
productId0
- Byte 0 of the given product IDproductId1
- Byte 1 of the given product IDproductId2
- Byte 2 of the given product IDproductId3
- Byte 3 of the given product ID
public void checkValid() throws InvalidFirmwareException
checkValid
in class Ztex1
InvalidFirmwareException
- if ZTEX descriptor 1 is not available or interface 1 is not supported.public void checkCapability(int i, int j) throws InvalidFirmwareException, CapabilityException
i
- byte index of the capabilityj
- bit index of the capability
InvalidFirmwareException
- if ZTEX descriptor 1 is not available or interface 1 is not supported.
CapabilityException
- if the given capability is not supported.public void checkCapability(int i) throws InvalidFirmwareException, CapabilityException
i
- capability index (0..47)
InvalidFirmwareException
- if ZTEX descriptor 1 is not available or interface 1 is not supported.
CapabilityException
- if the given capability is not supported.public boolean InterfaceCapabilities(int i)
i
- capability index (0..47)
public void checkCompatible(int productId0, int productId1, int productId2, int productId3) throws InvalidFirmwareException
compatible(int,int,int,int)
.
productId0
- Byte 0 of the given product IDproductId1
- Byte 1 of the given product IDproductId2
- Byte 2 of the given product IDproductId3
- Byte 3 of the given product ID
InvalidFirmwareException
- if the given product ID is not compatible or interface 1 is not supported.public void printFpgaState() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public boolean getFpgaConfiguration() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public java.lang.String getFpgaConfigurationStr() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public void resetFpga() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public long configureFpgaLS(java.io.InputStream inputStream, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
inputStream
- for reading the Bitstream.force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public long configureFpgaLS(java.lang.String fwFileName, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public boolean eepromState() throws UsbException, InvalidFirmwareException, CapabilityException
eepromBytes
and eepromChecksum
.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if EEPROM access is not supported by the firmware.public void eepromWrite(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The destination address of the EEPROM.buf
- The data.length
- The amount of bytes to be sent.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if EEPROM access is not supported by the firmware.public void eepromRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address of the EEPROM.buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if EEPROM access is not supported by the firmware.public long eepromUpload(ZtexIhxFile1 ihxFile, boolean force) throws IncompatibleFirmwareException, FirmwareUploadException, InvalidFirmwareException, CapabilityException
ihxFile
- The firmware image.force
- Skips the compatibility check if true.
IncompatibleFirmwareException
- if the given firmware is not compatible to the installed one, see compatible(int,int,int,int)
(Upload can be enforced using the force parameter.)
InvalidFirmwareException
- if interface 1 is not supported.
CapabilityException
- if EEPROM access is not supported by the firmware.
FirmwareUploadException
- if an error occurred while attempting to upload the firmware.public long eepromUpload(java.lang.String ihxFileName, boolean force) throws IncompatibleFirmwareException, FirmwareUploadException, InvalidFirmwareException, CapabilityException
ihxFileName
- The file name of the firmware image in ihx format. The file can be a regular file or a system resource (e.g. a file from the current jar archive).force
- Skips the compatibility check if true.
IncompatibleFirmwareException
- if the given firmware is not compatible to the installed one, see compatible(int,int,int,int)
(Upload can be enforced using the force parameter.)
InvalidFirmwareException
- if interface 1 is not supported.
CapabilityException
- if EEPROM access is not supported by the firmware.
FirmwareUploadException
- if an error occurred while attempting to upload the firmware.public void eepromDisable() throws FirmwareUploadException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
CapabilityException
- if EEPROM access is not supported by the firmware.
FirmwareUploadException
- if an error occurred while attempting to disable the firmware.public static java.lang.String flashStrError(int errNum)
errNum
- The error code.
public java.lang.String flashStrError()
public java.lang.String flash2StrError()
public boolean flashState() throws UsbException, InvalidFirmwareException, CapabilityException
flashEnabled()
, flashSectorSize()
and flashSectors()
.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public boolean flash2State() throws UsbException, InvalidFirmwareException, CapabilityException
flash2Enabled()
, flash2SectorSize()
and flash2Sectors()
.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public int getFlashEC() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public int getFlash2EC() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public void flashReadSector(int sector, int num, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The number of the first sector to be read.num
- The number of sectors to be read.buf
- A buffer for the storage of the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is to small.public void flashReadSector(int sector, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be read.buf
- A buffer for the storage of the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the Flash sector size.public void flash2ReadSector(int sector, int num, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The number of the first sector to be read.num
- The number of sectors to be read.buf
- A buffer for the storage of the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is to small.public void flash2ReadSector(int sector, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be read.buf
- A buffer for the storage of the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the 2nd Flash sector size.public void flashWriteSector(int sector, int num, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be written.num
- The number of sectors to be read.buf
- The data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is to small.public void flashWriteSector(int sector, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be written.buf
- The data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the Flash sector size.public void flash2WriteSector(int sector, int num, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be written.num
- The number of sectors to be read.buf
- The data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is to small.public void flash2WriteSector(int sector, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
sector
- The sector number to be written.buf
- The data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash access is not possible.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the 2nd Flash sector size.public boolean flashEnabled() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public boolean flash2Enabled() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public int flashSectorSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public int flash2SectorSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash access is not supported by the firmware.public int flashSectors() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public int flash2Sectors() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public long flashSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public long flash2Size() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public boolean printMmcState() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.public boolean printMmc2State() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if 2nd Flash memory access is not supported by the firmware.public long flashUploadBitstream(java.io.InputStream inputStream, int bs) throws BitstreamReadException, UsbException, InvalidFirmwareException, CapabilityException
If configuration data is present information about bitstream are stored there and Bitstream starts at sector 0.
On all other devices the information about the bitstream is stored in sector 0. This so called boot sector has the following format:
Bytes | Description |
0..7 | ID, must be "ZTEXBS",1,1 |
8..9 | The number of sectors used to store the Bitstream. 0 means no Bitstream. |
10..11 | The number of bytes in the last sector. |
12..sectorSize-1 | This data is reserved for future use and preserved by this method. |
The total size of the Bitstream is computed as ((bs[8] | (bs[9]<<8) - 1) * flash_sector_size + ((bs[10] | (bs[11]<<8)) where bs[i] denotes byte i of the boot sector.
The first sector of the Bitstream is sector 1.
inputStream
- for reading the Bitstream.bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.public long flashUploadBitstream(java.lang.String fwFileName, int bs) throws BitstreamReadException, UsbException, InvalidFirmwareException, CapabilityException
flashUploadBitstream(InputStream,int)
for further details.
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.public long flashUploadBitstream(java.lang.String fwFileName) throws BitstreamReadException, UsbException, InvalidFirmwareException, CapabilityException
flashUploadBitstream(InputStream,int)
for further details.
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.public void flashResetBitstream() throws UsbException, InvalidFirmwareException, CapabilityException
flashUploadBitstream(String)
.
If no boot sector is installed the method returns without any write action.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.public int flashFirstFreeSector() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.public java.lang.String flashInfo()
public java.lang.String flash2Info()
public int debugStackSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.public int debugMsgSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.public final int debugLastMsg()
debugReadMessages(boolean,byte[])
debugReadMessages(boolean,byte[])
public int debugReadMessages(boolean all, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException
debugNewMessages
.
The number of the latest message is returned by debugLastMsg()
.
all
- If true, all messages from stack are written to buf. If it is false, only the new messages are written to buf.buf
- The buffer to store the messages.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not possible.public java.lang.String xmegaStrError(int errNum)
errNum
- The error code.
public java.lang.String xmegaStrError()
public int xmegaState() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATxmega controllers are not supported by the firmware.public boolean xmegaEnabled() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATxmega controllers are not supported by the firmware.public int xmegaFlashPages() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATxmega controllers are not supported by the firmware.public int xmegaEepromPages() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATxmega controllers are not supported by the firmware.public int xmegaFlashPageSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATxmega controllers are not supported by the firmware.public int xmegaEepromPageSize() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if ATXmega controllers are not supported by the firmware.public void xmegaReset() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.public void xmegaNvmRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address of the NVM (PDI address space).buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.public void xmegaFlashRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address relative to the Flash memory base.buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- If a communication error occurs.
CapabilityException
- If NVRAM access to ATxmega is not supported by the firmware.public void xmegaEepromRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address relative to the EEPROM memory base.buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- If a communication error occurs.
CapabilityException
- If NVRAM access to ATxmega is not supported by the firmware.public void xmegaFuseRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address relative to the Fuse memory base.buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- If a communication error occurs.
CapabilityException
- If NVRAM access to ATxmega is not supported by the firmware.public int xmegaFuseRead(int addr) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The index of th Fuse.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- If a communication error occurs.
CapabilityException
- If NVRAM access to ATxmega is not supported by the firmware.public void xmegaFlashPageWrite(int addr, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
addr
- The source address relative to the Flash memory base.buf
- A buffer that stores the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the Flash page size.public void xmegaEepromPageWrite(int addr, byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
addr
- The source address relative to the EEPROM memory base.buf
- A buffer that stores the data.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than the EEPROM page size.public void xmegaFuseWrite(int addr, int val) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The index of th Fuse.val
- The value of th Fuse.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.public long xmegaWriteFirmware(IhxFile ihxFile) throws UsbException, InvalidFirmwareException, CapabilityException, FirmwareUploadException
ihxFile
- The firmware / data image.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.
FirmwareUploadException
- if the verification fails.public long xmegaWriteEeprom(IhxFile ihxFile) throws UsbException, InvalidFirmwareException, CapabilityException, FirmwareUploadException
ihxFile
- The firmware / data image.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if NVRAM access to ATxmega is not supported by the firmware.
FirmwareUploadException
- if the verification fails.public java.lang.String toString()
toString
in class Ztex1
public java.lang.String capabilityInfo(java.lang.String pf)
pf
- A separator between the single capabilities, e.g. ", "
public long configureFpgaHS(java.io.InputStream inputStream, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
inputStream
- for reading the Bitstream.force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public long configureFpgaHS(java.lang.String fwFileName, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public long configureFpga(java.io.InputStream inputStream, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException, java.io.IOException
inputStream
- for reading the Bitstream.force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.
java.io.IOException
- if mark/reset is not supportedpublic long configureFpga(java.lang.String fwFileName, boolean force, int bs) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).bs
- 0: disable bit swapping, 1: enable bit swapping, all other values: automatic detection of bit order.
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public long configureFpga(java.lang.String fwFileName, boolean force) throws BitstreamReadException, UsbException, BitstreamUploadException, AlreadyConfiguredException, InvalidFirmwareException, CapabilityException
fwFileName
- The file name of the Bitstream. The file can be a regular file or a system resource (e.g. a file from the current jar archive).force
- If set to true existing configurations will be overwritten. (By default an AlreadyConfiguredException
is thrown).
BitstreamReadException
- if an error occurred while attempting to read the Bitstream.
BitstreamUploadException
- if an error occurred while attempting to upload the Bitstream.
AlreadyConfiguredException
- if the FPGA is already configured.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if FPGA configuration is not supported by the firmware.public void macEepromWrite(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The destination address of the MAC EEPROM.buf
- The data.length
- The amount of bytes to be sent.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if MAC EEPROM access is not supported by the firmware or if configuration data is present and there is a write to addresses 0 to 79. In order to override this behavior set config
variable to null.public void macEepromRead(int addr, byte[] buf, int length) throws UsbException, InvalidFirmwareException, CapabilityException
addr
- The source address of the MAC EEPROM.buf
- A buffer for the storage of the data.length
- The amount of bytes to be read.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if MAC EEPROM access is not supported by the firmware.public boolean macEepromState() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if MAC EEPROM access is not supported by the firmware.public void macRead(byte[] buf) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
buf
- A buffer with a minimum size of 6 bytes.
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if MAC EEPROM access is not supported by the firmware.
java.lang.IndexOutOfBoundsException
- If the buffer is smaller than 6 bytes.public int numberOfFpgas() throws UsbException, InvalidFirmwareException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.public void selectFpga(int num) throws UsbException, InvalidFirmwareException, java.lang.IndexOutOfBoundsException
num
- FPGA to select. Valid values are 0 to numberOfFpgas()
-1
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
java.lang.IndexOutOfBoundsException
- If FPGA number is not in range.public double tempSensorRead(int idx) throws UsbException, InvalidFirmwareException, CapabilityException, java.lang.IndexOutOfBoundsException
idx
- Temperature sensor index
InvalidFirmwareException
- If interface 1 or temperature sensor protocol is not supported.
UsbException
- If a communication error occurs.
CapabilityException
- If NVRAM access to ATxmega is not supported by the firmware.
java.lang.IndexOutOfBoundsException
- If idx is not in range.public boolean printSpiState() throws UsbException, InvalidFirmwareException, CapabilityException
InvalidFirmwareException
- if interface 1 is not supported.
UsbException
- if a communication error occurs.
CapabilityException
- if Flash memory access is not supported by the firmware.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |