Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Java D2xx driver and Java IntelHex Parser Library #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions PhysicaloidLibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apply plugin: 'android-library'
apply plugin: 'com.android.library'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

android {
compileSdkVersion 18
buildToolsVersion '18.1.0'
compileSdkVersion 22
buildToolsVersion '22.0.1'

defaultConfig {
minSdkVersion 12
targetSdkVersion 12
targetSdkVersion 22
}

sourceSets {
Expand Down
Binary file modified PhysicaloidLibrary/libs/d2xx.jar
Binary file not shown.
209 changes: 209 additions & 0 deletions PhysicaloidLibrary/libs/d2xx_jar_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@

Driver Licence Terms
IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE INSTALLING THE RELEVANT SOFTWARE: This licence agreement
("Licence") is a legal agreement between you ("Licencee" or "you") and Future Technology Devices
International Limited of 2 Seaward Place, Centurion Business Park, Glasgow, Scotland, G41 1HH (UK Company
Number SC136640) ("Licensor" or "we) for use of driver software provided by the Licensor ("Software").

BY INSTALLING OR USING THIS SOFTWARE YOU AGREE TO THE TERMS OF THIS LICENCE WHICH WILL BIND YOU. IF YOU
DO NOT AGREE TO THE TERMS OF THIS LICENCE, WE ARE UNWILLING TO LICENSE THE SOFTWARE TO YOU AND YOU MUST
DISCONTINUE INSTALLATION OF THE SOFTWARE NOW.

1. Grant and scope of licence

1.1 In consideration of you agreeing to abide by the terms of this Licence, the Licensor hereby grants
to you a non-exclusive, non-transferable, royalty free licence to use the Software on the terms of
this Licence.

1.2 In this Licence a "Genuine FTDI Component" means an item of hardware that was manufactured for, and
sold by, the Licensor or a member of the Licensor's group of companies. It does not include any counterfeit
or fake products.

1.3 If you are a manufacturer of a device that includes a Genuine FTDI Component (each a "Device") then
you may install the Software onto that device. If you are a seller or distributor of a Device then
You may distribute the Software with the Device. If you are a user of a Device then you may install
the Software on the Device, or onto a computer system in order to use the Device.

1.4 In each of those cases you may:

1.4.1 install and use the Software for your purposes only; and

1.4.2 only use the Software in conjunction with products based on and/or incorporating a Genuine FTDI Component.

1.5 The Software will not function properly on or with a component that is not a Genuine FTDI Component.
Use of the Software as a driver for, or installation of the Software onto, a component that is not
a Genuine FTDI Component, including without limitation counterfeit components, MAY IRRETRIEVABLY DAMAGE
THAT COMPONENT. It is the Licensee's responsibility to make sure that all chips it installs the Software
on, or uses the Software as a driver for, are Genuine FTDI Components. If in doubt then contact the Licensor.


2. If a custom vendor ID and/or product ID or description string are used, it is the responsibility of
the product manufacturer to maintain any changes and subsequent WHQL re-certification as a result of
making these changes.


3. Licensee's undertakings

3.1 Except as expressly set out in this Licence or as permitted by any local law, you undertake:

3.1.1 not to copy the Software, except where such copying is incidental to normal use of the Software or
where it is necessary for the purpose of back-up or operational security;

3.1.2 not to rent, lease, sub-license, loan, translate, merge, adapt, vary or modify the Software or any
part of it;

3.1.3 not to make alterations to, or modifications of, the whole or any part of the Software nor permit
the Software or any part of it to be combined with, or become incorporated in, any other programs;

3.1.4 not to disassemble, de-compile, reverse engineer or create derivative works based on the whole or
any part of the Software;

3.1.5 to keep all copies of the Software secure;

3.1.6 to include the copyright notice of the Licensor on all entire and partial copies of the Software in
any form; and

3.1.7 not to provide, or otherwise make available, the Software in any form, in whole or in part (including,
but not limited to, program listings, object and source program listings, object code and source
code) to any person.


4. Intellectual property rights

4.1 You acknowledge that all intellectual property rights in the Software throughout the world belong to
the Licensor, that rights in the Software are licensed (not sold) to you, and that you have no rights
in, or to, the Software other than the right to use them in accordance with the terms of this Licence.


5. Warranty

5.1 To the maximum extent permitted by applicable law, the software is provided "as is".

5.2 All implied warranties, implied conditions and/or implied licences are excluded from this Licence,
including but not limited to implied warranties of quality and/or fitness for purpose (in all cases)
to the fullest extent permitted by law.


5.3 You acknowledge that the Software has not been developed to meet your individual requirements and that
the Software may not be uninterrupted or free of bugs or errors.


6. Licensor's liability

6.1 To the maximum extent permitted by applicable law, in no event shall the Licensor be liable for any:

6.1.1 special loss or damage;

6.1.2 incidental loss or damage;

6.1.3 indirect or consequential loss or damage:

6.1.4 loss of income;

6.1.5 loss of business;

6.1.6 loss of profits;

6.1.7 loss of revenue;

6.1.8 loss of contracts;

6.1.9 business interruption;

6.1.10 loss of the use of money or anticipated savings;

6.1.11 loss of information;

6.1.12 loss of opportunity;

6.1.13 loss of goodwill or reputation; and/or

6.1.14 loss of, damage to or corruption of data;

(in each case) of any kind howsoever arising and whether caused by delict (including negligence), breach
of contract or otherwise.

6.2 FTDI's total liability to you in relation to the Software shall not exceed 500 US Dollars.

6.3 Nothing in this Licence limits or excludes liability for death or personal injury or for fraud.


7. Termination

7.1 The Licensor may terminate this Licence immediately if:

7.1.1 you fail to comply with any of the terms and conditions of the Licence; or

7.1.2 you commence or participate in any legal proceedings against the Licensor.

7.2 Upon termination:

7.2.1 all rights granted to you under this Licence shall cease;

7.2.2 you must cease all activities authorised by this Licence; and

7.2.3 you must immediately delete or remove the Software from all computer equipment in your possession
and immediately destroy all copies of the Software then in your possession, custody or control.



8. Transfer of rights and obligations

8.1 You may not transfer, assign, charge or otherwise dispose of this Licence, or any of your rights or
obligations arising under it.

8.2 The Licensor may transfer, assign, charge, sub-contract or otherwise dispose of this Licence, or any
of his rights or obligations arising under it, at any time during the term of the Licence.


9. Waiver

9.1 If the Licensor fails, at any time during the term of this Licence, to insist on strict performance
of any of your obligations under this Licence, or if the Licensor fails to exercise any of the rights
or remedies to which he is entitled under this Licence, this shall not constitute a waiver of such
rights or remedies and shall not relieve you from compliance with such obligations.

9.2 A waiver by the Licensor of any default shall not constitute a waiver of any subsequent default.

9.3 No waiver by the Licensor of any of these terms and conditions shall be effective unless it is expressly
stated to be a waiver and is communicated to you in writing.


10. Severability

If any of the terms of this Licence are determined by any competent authority to be invalid, unlawful or
unenforceable to any extent, such term, condition or provision will to that extent be severed from the
remaining terms, conditions and provisions which will continue to be valid to the fullest extent permitted by law.


11. Entire agreement

11.1 This Licence constitutes the whole agreement between us and supersedes any previous arrangement,
understanding or agreement between us, relating to the licensing of the Software.

11.2 Each party acknowledges that in entering into this Licence it does not rely on any statement, representation,
warranty or understanding other than those expressly set out in this Licence. Each party agrees
that it will have no remedy in respect of any statement, representation, warranty or understanding
that is not expressly set out in this Licence. Each party agrees that its only remedy in respect
of those representations, statements, assurances and warranties that are set out in this Licence
will be for breach of contract in accordance with the terms of this Licence.

11.3 The parties agree that nothing in this Licence will limit or exclude any liability they may have
for fraud.


12. Miscellaneous

12.1 This Licence does not create a partnership or joint venture between the parties to it, nor authorise
a party to act as agent for the other.

12.2 This Licence does not create any legal rights enforceable by any third party.

12.3 This Licence may only be varied by express written legal agreement between the parties.


13. Law and jurisdiction

This Licence, its subject matter or its formation (including non-contractual disputes or claims) shall
be governed by and construed in accordance with Scots law and submitted to the non-exclusive jurisdiction
of the Scottish courts.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void parse(String filePath) throws FileNotFoundException, IOException, Ex
public void parse(InputStream is) throws FileNotFoundException, IOException, Exception {

ihp = new IntelHexParser(is);
ihpd = new IntelHexParserRun(0, 0xFFFF);
ihpd = new IntelHexParserRun(0, 0xFFFFFF);
ihp.setDataListener(ihpd);

ihp.parse();
Expand Down
91 changes: 91 additions & 0 deletions PhysicaloidLibrary/src/cz/jaybee/intelhex/BinWriter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* @license Copyright (c) 2015, Jan Breuer All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package cz.jaybee.intelhex;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Binary file writer
*
* @author Jan Breuer
* @license BSD 2-Clause
*/
public class BinWriter implements IntelHexDataListener {

private final Region outputRegion;
private final OutputStream destination;
private final byte[] buffer;
private final MemoryRegions regions;
private long maxAddress;
private final boolean minimize;

public BinWriter(Region outputRegion, OutputStream destination, boolean minimize) {
this.outputRegion = outputRegion;
this.destination = destination;
this.minimize = minimize;
this.buffer = new byte[(int) (outputRegion.getLength())];
Arrays.fill(buffer, (byte) 0xFF);
regions = new MemoryRegions();
maxAddress = outputRegion.getAddressStart();
}

@Override
public void data(long address, byte[] data) {
regions.add(address, data.length);

if ((address >= outputRegion.getAddressStart()) && (address <= outputRegion.getAddressEnd())) {
int length = data.length;
if ((address + length) > outputRegion.getAddressEnd()) {
length = (int) (outputRegion.getAddressEnd() - address + 1);
}
System.arraycopy(data, 0, buffer, (int) (address - outputRegion.getAddressStart()), length);

if (maxAddress < (address + data.length -1)) {
maxAddress = address + data.length - 1;
}
}
}

@Override
public void eof() {
try {
if (!minimize) {
maxAddress = outputRegion.getAddressEnd();
}
destination.write(buffer, 0, (int)(maxAddress - outputRegion.getAddressStart() + 1));
} catch (IOException ex) {
Logger.getLogger(BinWriter.class.getName()).log(Level.SEVERE, null, ex);
}
}

public MemoryRegions getMemoryRegions() {
return regions;
}
}
Loading