Esempio n. 1
0
 public static QsiMessage getReset() {
   QsiMessage m = new QsiMessage(3);
   m.setOpCode(0);
   m.setLength(0);
   m.setChecksum();
   return m.frame();
 }
Esempio n. 2
0
 // Bootloader messages are initially created long enough for
 // the message and checksum. The message is then framed with control
 // characters before being returned
 public static QsiMessage getReadBootVersion() {
   QsiMessage m = new QsiMessage(3);
   m.setOpCode(RD_VER);
   m.setLength(2);
   m.setChecksum();
   return m.frame();
 }
Esempio n. 3
0
 public static QsiMessage getWriteEE(int addr, int[] data) {
   QsiMessage m = new QsiMessage(6 + data.length);
   m.setOpCode(WT_EEDATA);
   m.setLength(data.length);
   m.setAddress(addr & 0xff);
   m.setData(data);
   m.setChecksum();
   return m.frame();
 }
Esempio n. 4
0
 public static QsiMessage getEraseFlash(int addr, int rows) {
   QsiMessage m = new QsiMessage(6);
   m.setOpCode(ER_FLASH);
   // Erase a number of 64 byte rows
   m.setLength(rows);
   m.setAddress(addr);
   m.setChecksum();
   return m.frame();
 }
Esempio n. 5
0
 public static QsiMessage getWriteFlash(int addr, int[] data) {
   int l = data.length;
   // Writes are rounded up to multiples of 8 bytes
   if (l % 8 != 0) {
     l = l + (8 - l % 8);
   }
   // and data padded with erased condition
   int padded[] = new int[l];
   for (int i = 0; i < l; i++) {
     if (i < data.length) {
       padded[i] = data[i];
     } else {
       padded[i] = 0xff;
     }
   }
   QsiMessage m = new QsiMessage(6 + l);
   m.setOpCode(WT_FLASH);
   // length is number of 8 byte blocks
   m.setLength(l / 8);
   m.setAddress(addr);
   m.setData(padded);
   m.setChecksum();
   return m.frame();
 }