OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_11/usb_fpga_1_11/trunk

Subversion Repositories usb_fpga_1_11

[/] [usb_fpga_1_11/] [trunk/] [java/] [ztex/] [ZtexIhxFile1.java] - Diff between revs 5 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 5 Rev 8
Line 45... Line 45...
 
 
// ******* ZtexIhxFile1 ********************************************************
// ******* ZtexIhxFile1 ********************************************************
/**
/**
  * Constructs an instance from a given file name and descriptor position.<br>
  * Constructs an instance from a given file name and descriptor position.<br>
  * This method can also read system resources, e.g. files from the current jar archive.
  * This method can also read system resources, e.g. files from the current jar archive.
  * @param fileName The file name.
  * @param in Input stream from which the ihx file is read.
 
  * @param name Name of the input.
  * @param pZtexDescriptorOffs The position of the descriptor in bytes. The default position is 0x6c.
  * @param pZtexDescriptorOffs The position of the descriptor in bytes. The default position is 0x6c.
  * @throws IOException If an read error occurred.
  * @throws IOException If an read error occurred.
  * @throws IhxFileDamagedException If the ihx file is damaged.
  * @throws IhxFileDamagedException If the ihx file is damaged.
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
  */
  */
    public ZtexIhxFile1( String fileName, int pZtexDescriptorOffs ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
    public ZtexIhxFile1( InputStream in, String name, int pZtexDescriptorOffs ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
        super( fileName );
        super( in, name );
 
 
        ztexDescriptorOffs = pZtexDescriptorOffs;
        ztexDescriptorOffs = pZtexDescriptorOffs;
 
 
        if ( ihxData[ztexDescriptorOffs]!=40 || ihxData[ztexDescriptorOffs+1]!=1 || ihxData[ztexDescriptorOffs+2]!='Z' || ihxData[ztexDescriptorOffs+3]!='T' || ihxData[ztexDescriptorOffs+4]!='E' || ihxData[ztexDescriptorOffs+5]!='X' )
        if ( ihxData[ztexDescriptorOffs]!=40 || ihxData[ztexDescriptorOffs+1]!=1 || ihxData[ztexDescriptorOffs+2]!='Z' || ihxData[ztexDescriptorOffs+3]!='T' || ihxData[ztexDescriptorOffs+4]!='E' || ihxData[ztexDescriptorOffs+5]!='X' )
            throw new IncompatibleFirmwareException( "Invalid ZTEX descriptor" );
            throw new IncompatibleFirmwareException( "Invalid ZTEX descriptor" );
Line 101... Line 102...
            if ( ihxData[i]<0 && ihxData[i+1]>=0 )
            if ( ihxData[i]<0 && ihxData[i+1]>=0 )
                ihxData[i] = 0;
                ihxData[i] = 0;
    }
    }
 
 
/**
/**
 
  * Constructs an instance from a given file name and descriptor position.<br>
 
  * The ZTEX descriptor 1 is expected to be at the position 0x6c of the firmware image.<br>
 
  * This method can also read system resources, e.g. files from the current jar archive.
 
  * @param in Input stream from which the ihx file is read.
 
  * @param name Name of the input.
 
  * @throws IOException If an read error occurred.
 
  * @throws IhxFileDamagedException If the ihx file is damaged.
 
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
 
  */
 
    public ZtexIhxFile1( InputStream in, String name ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
 
        this( in, name, defaultZtexDescriptorOffs );
 
    }
 
 
 
/**
 
  * Constructs an instance from a given file name and descriptor position.<br>
 
  * This method can also read system resources, e.g. files from the current jar archive.
 
  * @param fileName The file name.
 
  * @param pZtexDescriptorOffs The position of the descriptor in bytes. The default position is 0x6c.
 
  * @throws IOException If an read error occurred.
 
  * @throws IhxFileDamagedException If the ihx file is damaged.
 
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
 
  */
 
    public ZtexIhxFile1( String fileName , int pZtexDescriptorOffs ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
 
        this( JInputStream.getInputStream(fileName), fileName, pZtexDescriptorOffs );
 
 
 
    }
 
 
 
/**
  * Constructs an instance from a given file name.
  * Constructs an instance from a given file name.
  * The ZTEX descriptor 1 is expected to be at the position 0x6c of the firmware image.<br>
  * The ZTEX descriptor 1 is expected to be at the position 0x6c of the firmware image.<br>
  * This method can also read system resources, e.g. files from the current jar archive.
  * This method can also read system resources, e.g. files from the current jar archive.
  * @param fileName The file name.
  * @param fileName The file name.
  * @throws IOException If an read error occurred.
  * @throws IOException If an read error occurred.
  * @throws IhxFileDamagedException If the ihx file is damaged.
  * @throws IhxFileDamagedException If the ihx file is damaged.
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
  * @throws IncompatibleFirmwareException If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
  */
  */
    public ZtexIhxFile1( String fileName ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
    public ZtexIhxFile1( String fileName ) throws IOException, IhxFileDamagedException, IncompatibleFirmwareException {
        this( fileName, defaultZtexDescriptorOffs );
        this( JInputStream.getInputStream(fileName), fileName, defaultZtexDescriptorOffs );
    }
    }
 
 
// ******* productId ***********************************************************
// ******* productId ***********************************************************
/**
/**
  * Returns the product ID (all 4 bytes).
  * Returns the product ID (all 4 bytes).

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.