X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosSelfFlash.java;h=1be45998f3d17c3a9483b79d3a9e9e22693aaa12;hp=07952d7f76fc97ba61519a4a55ef79ce6a91183a;hb=cb23b992be8ba40c97d8988c134a814a13ccd58c;hpb=2cdb90d9214f8e66b3574cbd9c5ed073a7861681 diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java index 07952d7f..1be45998 100644 --- a/altoslib/AltosSelfFlash.java +++ b/altoslib/AltosSelfFlash.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_2; +package org.altusmetrum.altoslib_7; import java.io.*; @@ -47,7 +47,7 @@ public class AltosSelfFlash extends AltosProgrammer { for (int offset = 0; offset < len; offset += 0x100) { link.printf("R %x\n", addr + offset); byte[] reply = link.get_binary_reply(5000, 0x100); - + if (reply == null) throw new IOException("Read device memory timeout"); for (b = 0; b < len; b++) @@ -55,10 +55,9 @@ public class AltosSelfFlash extends AltosProgrammer { } return data; } - + void write_memory(long addr, byte[] data, int start, int len) { int b; - System.out.printf ("write_memory %x %d\n", addr, len); link.printf("W %x\n", addr); link.flush_output(); for (b = 0; b < len; b++) @@ -68,7 +67,6 @@ public class AltosSelfFlash extends AltosProgrammer { } void reboot() { - System.out.printf("reboot\n"); link.printf("a\n"); link.flush_output(); } @@ -115,7 +113,6 @@ public class AltosSelfFlash extends AltosProgrammer { action(image.data.length - remain, image.data.length); } if (!aborted) { - System.out.printf ("done\n"); action("done", 100); } close(); @@ -130,7 +127,10 @@ public class AltosSelfFlash extends AltosProgrammer { public void close() { if (link != null) { reboot(); - link.close(); + try { + link.close(); + } catch (InterruptedException ie) { + } link = null; } } @@ -140,8 +140,7 @@ public class AltosSelfFlash extends AltosProgrammer { close(); } - private AltosHexfile get_rom() { - System.out.printf("get rom\n"); + private AltosHexfile get_rom() throws InterruptedException { try { int base = AltosRomconfig.fetch_base(image); int bounds = AltosRomconfig.fetch_bounds(image); @@ -150,9 +149,6 @@ public class AltosSelfFlash extends AltosProgrammer { hexfile.add_symbols(image); return hexfile; } catch (AltosNoSymbol none) { - System.out.printf("no symbol %s\n", none.getMessage()); - return null; - } catch (InterruptedException ie) { return null; } catch (IOException ie) { return null; @@ -160,9 +156,8 @@ public class AltosSelfFlash extends AltosProgrammer { } - public boolean check_rom_config() { + public boolean check_rom_config() throws InterruptedException { if (link == null) { - System.out.printf ("no link\n"); return true; } if (rom_config == null) { @@ -177,8 +172,7 @@ public class AltosSelfFlash extends AltosProgrammer { rom_config = romconfig; } - public AltosRomconfig romconfig() { - System.out.printf("fetch romconfig\n"); + public AltosRomconfig romconfig() throws InterruptedException { if (!check_rom_config()) return null; return rom_config; @@ -191,6 +185,5 @@ public class AltosSelfFlash extends AltosProgrammer { this.listener = listener; input = new FileInputStream(file); image = new AltosHexfile(input); - System.out.printf ("AltosSelfFlash %x\n", image.address); } } \ No newline at end of file