1 package com.atmel.fpslic;
5 public class ChipImpl extends FtdiUart implements Chip {
22 public void doReset() {
45 //try { Thread.sleep(500); } catch (Exception e) { }
49 try { Thread.sleep(500); } catch (Exception e) { }
50 if (initErr()) throw new RuntimeException("INIT was still high after pulling RESET low");
51 //System.out.println("0 con() = " + con());
55 try { Thread.sleep(500); } catch (Exception e) { }
56 if (!initErr()) throw new RuntimeException("INIT was still low after releasing RESET");
57 //System.out.println("1 con() = " + con());
61 public void config(boolean bit) { config(bit?1:0, 1); }
62 public void config(int dat) { config(dat, 8); }
63 public void config(int dat, int numbits) {
64 for(int i=(numbits-1); i>=0; i--) {
65 boolean bit = (dat & (1<<i)) != 0;
72 // tricky: RESET has a weak pull-up, and is wired to a CBUS line. So,
73 // we can pull it down (assert reset) from uart-mode, or we can
74 // let it float upward from either mode.
75 public void reset(boolean on) {
76 bits = on ? (1<<1) : 0;
89 public void avrrst(boolean on) { dbang(7, on); }
90 public void clk(boolean on) { dbang(6, on); }
91 public void data(boolean on) { dbang(5, on); }
93 public boolean initErr() { flush(); return (readPins() & (1<<4))!=0; }
95 public boolean con() {
99 return (readPins() & (1<<0)) != 0;
101 public boolean rcon() {
105 return (readPins() & (1<<0)) != 0;
107 public void con(boolean on) {