1 package com.atmel.fpslic;
5 public class ChipImpl extends FtdiUart implements Chip {
18 super(0x6666, 0x3133, 1500 * 1000);
24 getOutputStream().flush();
25 } catch (Exception e) { throw new RuntimeException(e); }
28 public void doReset() {
51 //try { Thread.sleep(500); } catch (Exception e) { }
55 try { Thread.sleep(500); } catch (Exception e) { }
56 if (initErr()) throw new RuntimeException("INIT was still high after pulling RESET low");
57 //System.out.println("0 con() = " + con());
61 try { Thread.sleep(500); } catch (Exception e) { }
62 if (!initErr()) throw new RuntimeException("INIT was still low after releasing RESET");
63 //System.out.println("1 con() = " + con());
67 public void config(boolean bit) { config(bit?1:0, 1); }
68 public void config(int dat) { config(dat, 8); }
69 public void config(int dat, int numbits) {
70 for(int i=(numbits-1); i>=0; i--) {
71 boolean bit = (dat & (1<<i)) != 0;
78 // tricky: RESET has a weak pull-up, and is wired to a CBUS line. So,
79 // we can pull it down (assert reset) from uart-mode, or we can
80 // let it float upward from either mode.
81 public void reset(boolean on) {
82 uart(1<<1, on ? (1<<1) : 0);
90 public void avrrst(boolean on) { dbang(7, on); }
91 public void clk(boolean on) { dbang(6, on); }
92 public void data(boolean on) { dbang(5, on); }
94 public boolean initErr() { flush(); return (readPins() & (1<<4))!=0; }
96 public boolean con() {
100 return (readPins() & (1<<0)) != 0;
102 public boolean rcon() {
106 return (readPins() & (1<<0)) != 0;
108 public void con(boolean on) {