Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 223245
Collapse All | Expand All

(-)avrdude-5.5/stk500.c (+43 lines)
Lines 1220-1225 Link Here
1220
  stk500_print_parms1(pgm, "");
1220
  stk500_print_parms1(pgm, "");
1221
}
1221
}
1222
1222
1223
/* Signature byte reads are always 3 bytes. */
1224
static int stk500_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
1225
{
1226
  unsigned char buf[32];
1227
  unsigned char tmp;
1228
1229
  if (m->size < 3) {
1230
    fprintf(stderr, "%s: memsize too small for sig byte read", progname);
1231
    return -1;
1232
  }
1233
1234
  buf[0] = Cmnd_STK_READ_SIGN;
1235
  buf[1] = Sync_CRC_EOP;
1236
     
1237
  stk500_send(pgm, buf, 2);
1238
  
1239
  if (stk500_recv(pgm, buf, 5) < 0)
1240
    return -1;
1241
  if (buf[0] == Resp_STK_NOSYNC) {
1242
    fprintf(stderr, "%s: stk500_cmd(): programmer is out of sync\n", progname);
1243
    return -1;
1244
  } else if (buf[0] != Resp_STK_INSYNC) {
1245
    fprintf(stderr,
1246
            "\n%s: stk500_read_sig_bytes(): (a) protocol error, "
1247
            "expect=0x%02x, resp=0x%02x\n", 
1248
            progname, Resp_STK_INSYNC, buf[0]);
1249
    return -2;
1250
  }
1251
  if (buf[4] != Resp_STK_OK) {
1252
    fprintf(stderr,
1253
            "\n%s: stk500_read_sig_bytes(): (a) protocol error, "
1254
            "expect=0x%02x, resp=0x%02x\n", 
1255
            progname, Resp_STK_OK, buf[4]);
1256
    return -3;
1257
  }
1258
  
1259
  m->buf[0] = buf[1];
1260
  m->buf[1] = buf[2];
1261
  m->buf[2] = buf[3];
1262
1263
  return 3;
1264
}
1223
1265
1224
void stk500_initpgm(PROGRAMMER * pgm)
1266
void stk500_initpgm(PROGRAMMER * pgm)
1225
{
1267
{
Lines 1250-1254 Link Here
1250
  pgm->set_varef      = stk500_set_varef;
1292
  pgm->set_varef      = stk500_set_varef;
1251
  pgm->set_fosc       = stk500_set_fosc;
1293
  pgm->set_fosc       = stk500_set_fosc;
1252
  pgm->set_sck_period = stk500_set_sck_period;
1294
  pgm->set_sck_period = stk500_set_sck_period;
1295
  pgm->read_sig_bytes = stk500_read_sig_bytes;
1253
  pgm->page_size      = 256;
1296
  pgm->page_size      = 256;
1254
}
1297
}

Return to bug 223245