Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
avrpart.c File Reference
#include <stdlib.h>
#include <string.h>
#include "avrdude.h"
#include "libavrdude.h"
+ Include dependency graph for avrpart.c:

Go to the source code of this file.

Functions

OPCODEavr_new_opcode (void)
 
static OPCODEavr_dup_opcode (OPCODE *op)
 
void avr_free_opcode (OPCODE *op)
 
int avr_set_bits (OPCODE *op, unsigned char *cmd)
 
int avr_set_addr (OPCODE *op, unsigned char *cmd, unsigned long addr)
 
int avr_set_input (OPCODE *op, unsigned char *cmd, unsigned char data)
 
int avr_get_output (OPCODE *op, unsigned char *res, unsigned char *data)
 
int avr_get_output_index (OPCODE *op)
 
static char * avr_op_str (int op)
 
static char * bittype (int type)
 
AVRMEMavr_new_memtype (void)
 
int avr_initmem (AVRPART *p)
 
AVRMEMavr_dup_mem (AVRMEM *m)
 
void avr_free_mem (AVRMEM *m)
 
AVRMEMavr_locate_mem (AVRPART *p, char *desc)
 
void avr_mem_display (const char *prefix, FILE *f, AVRMEM *m, int type, int verbose)
 
AVRPARTavr_new_part (void)
 
AVRPARTavr_dup_part (AVRPART *d)
 
void avr_free_part (AVRPART *d)
 
AVRPARTlocate_part (LISTID parts, char *partdesc)
 
AVRPARTlocate_part_by_avr910_devcode (LISTID parts, int devcode)
 
AVRPARTlocate_part_by_signature (LISTID parts, unsigned char *sig, int sigsize)
 
void walk_avrparts (LISTID avrparts, walk_avrparts_cb cb, void *cookie)
 
static int sort_avrparts_compare (AVRPART *p1, AVRPART *p2)
 
void sort_avrparts (LISTID avrparts)
 
static char * reset_disp_str (int r)
 
void avr_display (FILE *f, AVRPART *p, const char *prefix, int verbose)
 

Function Documentation

◆ avr_display()

void avr_display ( FILE *  f,
AVRPART p,
const char *  prefix,
int  verbose 
)
622{
623 int i;
624 char * buf;
625 const char * px;
626 LNODEID ln;
627 AVRMEM * m;
628
630 "%sAVR Part : %s\n"
631 "%sChip Erase delay : %d us\n"
632 "%sPAGEL : P%02X\n"
633 "%sBS2 : P%02X\n"
634 "%sRESET disposition : %s\n"
635 "%sRETRY pulse : %s\n"
636 "%sserial program mode : %s\n"
637 "%sparallel program mode : %s\n"
638 "%sTimeout : %d\n"
639 "%sStabDelay : %d\n"
640 "%sCmdexeDelay : %d\n"
641 "%sSyncLoops : %d\n"
642 "%sByteDelay : %d\n"
643 "%sPollIndex : %d\n"
644 "%sPollValue : 0x%02x\n"
645 "%sMemory Detail :\n\n",
646 prefix, p->desc,
647 prefix, p->chip_erase_delay,
648 prefix, p->pagel,
649 prefix, p->bs2,
651 prefix, avr_pin_name(p->retry_pulse),
652 prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no",
653 prefix, (p->flags & AVRPART_PARALLELOK) ?
654 ((p->flags & AVRPART_PSEUDOPARALLEL) ? "psuedo" : "yes") : "no",
655 prefix, p->timeout,
656 prefix, p->stabdelay,
657 prefix, p->cmdexedelay,
658 prefix, p->synchloops,
659 prefix, p->bytedelay,
660 prefix, p->pollindex,
661 prefix, p->pollvalue,
662 prefix);
663
664 px = prefix;
665 i = (int)strlen(prefix) + 5;
666 buf = (char *)malloc(i);
667 if (buf == NULL) {
668 /* ugh, this is not important enough to bail, just ignore it */
669 }
670 else {
671 strcpy(buf, prefix);
672 strcat(buf, " ");
673 px = buf;
674 }
675
676 if (verbose <= 2) {
677 avr_mem_display(px, f, NULL, 0, verbose);
678 }
679 for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
680 m = ldata(ln);
681 avr_mem_display(px, f, m, i, verbose);
682 }
683
684 if (buf)
685 free(buf);
686}
int verbose
Definition main.c:198
#define MSG_INFO
Definition avrdude.h:51
int avrdude_message(const int msglvl, const char *format,...)
Definition main.c:93
static char * reset_disp_str(int r)
Definition avrpart.c:611
void avr_mem_display(const char *prefix, FILE *f, AVRMEM *m, int type, int verbose)
Definition avrpart.c:379
void * malloc(YYSIZE_T)
void free(void *)
#define AVRPART_PSEUDOPARALLEL
Definition libavrdude.h:197
unsigned char pagel
Definition libavrdude.h:223
const char * avr_pin_name(int pinname)
Definition pindefs.c:354
void * ldata(LNODEID)
Definition lists.c:720
#define AVRPART_PARALLELOK
Definition libavrdude.h:196
void * LNODEID
Definition libavrdude.h:64
int chip_erase_delay
Definition libavrdude.h:222
char desc[AVR_DESCLEN]
Definition libavrdude.h:218
LNODEID lnext(LNODEID)
Definition lists.c:704
#define AVRPART_SERIALOK
Definition libavrdude.h:195
LNODEID lfirst(LISTID)
Definition lists.c:688
int reset_disposition
Definition libavrdude.h:227
unsigned char bs2
Definition libavrdude.h:224
unsigned flags
Definition libavrdude.h:230
int retry_pulse
Definition libavrdude.h:228
LISTID mem
Definition libavrdude.h:277
Definition libavrdude.h:283

References avr_mem_display(), avr_pin_name(), avrdude_message(), AVRPART_PARALLELOK, AVRPART_PSEUDOPARALLEL, AVRPART_SERIALOK, avrpart::bs2, avrpart::bytedelay, avrpart::chip_erase_delay, avrpart::cmdexedelay, avrpart::desc, avrpart::flags, free(), ldata(), lfirst(), lnext(), malloc(), avrpart::mem, MSG_INFO, avrpart::pagel, avrpart::pollindex, avrpart::pollvalue, reset_disp_str(), avrpart::reset_disposition, avrpart::retry_pulse, avrpart::stabdelay, avrpart::synchloops, avrpart::timeout, and verbose.

Referenced by avrdude_main(), and cmd_part().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_dup_mem()

AVRMEM * avr_dup_mem ( AVRMEM m)
295{
296 AVRMEM * n;
297 int i;
298
299 n = avr_new_memtype();
300
301 *n = *m;
302
303 if (m->buf != NULL) {
304 n->buf = (unsigned char *)malloc(n->size);
305 if (n->buf == NULL) {
306 // avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n",
307 // n->size);
308 // exit(1);
309 avrdude_oom("avr_dup_mem(): out of memory");
310 }
311 memcpy(n->buf, m->buf, n->size);
312 }
313
314 if (m->tags != NULL) {
315 n->tags = (unsigned char *)malloc(n->size);
316 if (n->tags == NULL) {
317 // avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n",
318 // n->size);
319 // exit(1);
320 avrdude_oom("avr_dup_mem(): out of memory");
321 }
322 memcpy(n->tags, m->tags, n->size);
323 }
324
325 for (i = 0; i < AVR_OP_MAX; i++) {
326 n->op[i] = avr_dup_opcode(n->op[i]);
327 }
328
329 return n;
330}
void avrdude_oom(const char *context)
Definition main.c:169
AVRMEM * avr_new_memtype(void)
Definition avrpart.c:248
static OPCODE * avr_dup_opcode(OPCODE *op)
Definition avrpart.c:49
unsigned char * tags
Definition libavrdude.h:305
int size
Definition libavrdude.h:286
@ AVR_OP_MAX
Definition libavrdude.h:158
unsigned char * buf
Definition libavrdude.h:304
OPCODE * op[AVR_OP_MAX]
Definition libavrdude.h:306

References avr_dup_opcode(), avr_new_memtype(), AVR_OP_MAX, avrdude_oom(), avrmem::buf, malloc(), avrmem::op, avrmem::size, and avrmem::tags.

Referenced by avr_dup_part().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_dup_opcode()

static OPCODE * avr_dup_opcode ( OPCODE op)
static
50{
51 OPCODE * m;
52
53 /* this makes life easier */
54 if (op == NULL) {
55 return NULL;
56 }
57
58 m = (OPCODE *)malloc(sizeof(*m));
59 if (m == NULL) {
60 // avrdude_message(MSG_INFO, "avr_dup_opcode(): out of memory\n");
61 // exit(1);
62 avrdude_oom("avr_dup_opcode(): out of memory\n");
63 }
64
65 memcpy(m, op, sizeof(*m));
66
67 return m;
68}
Definition libavrdude.h:190

References avrdude_oom(), and malloc().

Referenced by avr_dup_mem(), and avr_dup_part().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_dup_part()

AVRPART * avr_dup_part ( AVRPART d)
474{
475 AVRPART * p;
476 LISTID save;
477 LNODEID ln;
478 int i;
479
480 p = avr_new_part();
481 save = p->mem;
482
483 *p = *d;
484
485 p->mem = save;
486
487 for (ln=lfirst(d->mem); ln; ln=lnext(ln)) {
488 ladd(p->mem, avr_dup_mem(ldata(ln)));
489 }
490
491 for (i = 0; i < AVR_OP_MAX; i++) {
492 p->op[i] = avr_dup_opcode(p->op[i]);
493 }
494
495 return p;
496}
void save(Archive &archive, wxString const &d)
Definition GLGizmoEmboss.cpp:1557
AVRMEM * avr_dup_mem(AVRMEM *m)
Definition avrpart.c:294
AVRPART * avr_new_part(void)
Definition avrpart.c:443
void * LISTID
Definition libavrdude.h:63
int ladd(LISTID lid, void *p)
Definition lists.c:547
OPCODE * op[AVR_OP_MAX]
Definition libavrdude.h:275
Definition libavrdude.h:217

References avr_dup_mem(), avr_dup_opcode(), avr_new_part(), AVR_OP_MAX, ladd(), ldata(), lfirst(), lnext(), avrpart::mem, avrpart::op, and save().

Referenced by do_op(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_free_mem()

void avr_free_mem ( AVRMEM m)
333{
334 int i;
335 if (m->buf != NULL) {
336 free(m->buf);
337 m->buf = NULL;
338 }
339 if (m->tags != NULL) {
340 free(m->tags);
341 m->tags = NULL;
342 }
343 for(i=0;i<sizeof(m->op)/sizeof(m->op[0]);i++)
344 {
345 if (m->op[i] != NULL)
346 {
347 avr_free_opcode(m->op[i]);
348 m->op[i] = NULL;
349 }
350 }
351 free(m);
352}
void avr_free_opcode(OPCODE *op)
Definition avrpart.c:70

References avr_free_opcode(), avrmem::buf, free(), avrmem::op, and avrmem::tags.

Referenced by avr_free_part(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_free_opcode()

void avr_free_opcode ( OPCODE op)
71{
72 free(op);
73}

References free().

Referenced by avr_free_mem(), avr_free_part(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_free_part()

void avr_free_part ( AVRPART d)
499{
500int i;
501 ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem);
502 d->mem = NULL;
503 for(i=0;i<sizeof(d->op)/sizeof(d->op[0]);i++)
504 {
505 if (d->op[i] != NULL)
506 {
507 avr_free_opcode(d->op[i]);
508 d->op[i] = NULL;
509 }
510 }
511 free(d);
512}
void avr_free_mem(AVRMEM *m)
Definition avrpart.c:332
void ldestroy_cb(LISTID lid, void(*ucleanup)(void *data_ptr))
Definition lists.c:480

References avr_free_mem(), avr_free_opcode(), free(), and ldestroy_cb().

Referenced by cleanup_config(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_get_output()

int avr_get_output ( OPCODE op,
unsigned char *  res,
unsigned char *  data 
)
166{
167 int i, j, bit;
168 unsigned char value;
169 unsigned char mask;
170
171 for (i=0; i<32; i++) {
172 if (op->bit[i].type == AVR_CMDBIT_OUTPUT) {
173 j = 3 - i / 8;
174 bit = i % 8;
175 mask = 1 << bit;
176 value = ((res[j] & mask) >> bit) & 0x01;
177 value = value << op->bit[i].bitno;
178 if (value)
179 *data = *data | value;
180 else
181 *data = *data & ~value;
182 }
183 }
184
185 return 0;
186}
@ AVR_CMDBIT_OUTPUT
Definition libavrdude.h:167
int bitno
Definition libavrdude.h:186
CMDBIT bit[32]
Definition libavrdude.h:191
int type
Definition libavrdude.h:185
constexpr auto data(C &c) -> decltype(c.data())
Definition span.hpp:195

References AVR_CMDBIT_OUTPUT, opcode::bit, cmdbit::bitno, and cmdbit::type.

Referenced by avr_read_byte_default().

+ Here is the caller graph for this function:

◆ avr_get_output_index()

int avr_get_output_index ( OPCODE op)
196{
197 int i, j;
198
199 for (i=0; i<32; i++) {
200 if (op->bit[i].type == AVR_CMDBIT_OUTPUT) {
201 j = 3 - i / 8;
202 return j;
203 }
204 }
205
206 return -1;
207}

References AVR_CMDBIT_OUTPUT, opcode::bit, and cmdbit::type.

Referenced by stk500isp_read_byte().

+ Here is the caller graph for this function:

◆ avr_initmem()

int avr_initmem ( AVRPART p)
270{
271 LNODEID ln;
272 AVRMEM * m;
273
274 for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
275 m = ldata(ln);
276 m->buf = (unsigned char *) malloc(m->size);
277 if (m->buf == NULL) {
278 avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
279 progname, m->desc, m->size);
280 return -1;
281 }
282 m->tags = (unsigned char *) malloc(m->size);
283 if (m->tags == NULL) {
284 avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
285 progname, m->desc, m->size);
286 return -1;
287 }
288 }
289
290 return 0;
291}
char * progname
Definition main.c:61
char desc[AVR_MEMDESCLEN]
Definition libavrdude.h:284

References avrdude_message(), avrmem::buf, avrmem::desc, ldata(), lfirst(), lnext(), malloc(), avrpart::mem, MSG_INFO, progname, avrmem::size, and avrmem::tags.

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_locate_mem()

AVRMEM * avr_locate_mem ( AVRPART p,
char *  desc 
)
355{
356 AVRMEM * m, * match;
357 LNODEID ln;
358 int matches;
359 int l;
360
361 l = (int)strlen(desc);
362 matches = 0;
363 match = NULL;
364 for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
365 m = ldata(ln);
366 if (strncmp(desc, m->desc, l) == 0) {
367 match = m;
368 matches++;
369 }
370 }
371
372 if (matches == 1)
373 return match;
374
375 return NULL;
376}

References avrmem::desc, ldata(), lfirst(), lnext(), and avrpart::mem.

Referenced by avr_get_cycle_count(), avr_put_cycle_count(), avr_read(), avr_tpi_chip_erase(), avr_verify(), avr_write(), avrdude_main(), bitbang_chip_erase(), cmd_dump(), cmd_sig(), cmd_write(), do_op(), fileio(), jtag3_initialize(), jtagmkII_initialize(), safemode_readfuses(), safemode_writefuse(), stk500_initialize(), stk500v2_initialize(), stk600_xprog_chip_erase(), stk600_xprog_program_enable(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_mem_display()

void avr_mem_display ( const char *  prefix,
FILE *  f,
AVRMEM m,
int  type,
int  verbose 
)
381{
382 int i, j;
383 char * optr;
384
385 if (m == NULL) {
387 "%s Block Poll Page Polled\n"
388 "%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
389 "%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
390 prefix, prefix, prefix);
391 }
392 else {
393 if (verbose > 2) {
395 "%s Block Poll Page Polled\n"
396 "%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
397 "%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
398 prefix, prefix, prefix);
399 }
401 "%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n",
402 prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex,
403 m->paged ? "yes" : "no",
404 m->size,
405 m->page_size,
406 m->num_pages,
407 m->min_write_delay,
408 m->max_write_delay,
409 m->readback[0],
410 m->readback[1]);
411 if (verbose > 4) {
412 avrdude_message(MSG_TRACE2, "%s Memory Ops:\n"
413 "%s Oeration Inst Bit Bit Type Bitno Value\n"
414 "%s ----------- -------- -------- ----- -----\n",
415 prefix, prefix, prefix);
416 for (i=0; i<AVR_OP_MAX; i++) {
417 if (m->op[i]) {
418 for (j=31; j>=0; j--) {
419 if (j==31)
420 optr = avr_op_str(i);
421 else
422 optr = " ";
424 "%s %-11s %8d %8s %5d %5d\n",
425 prefix, optr, j,
426 bittype(m->op[i]->bit[j].type),
427 m->op[i]->bit[j].bitno,
428 m->op[i]->bit[j].value);
429 }
430 }
431 }
432 }
433 }
434}
#define MSG_TRACE2
Definition avrdude.h:56
static char * avr_op_str(int op)
Definition avrpart.c:210
static char * bittype(int type)
Definition avrpart.c:230
int blocksize
Definition libavrdude.h:300
int value
Definition libavrdude.h:187
int pollindex
Definition libavrdude.h:302
int paged
Definition libavrdude.h:285
int mode
Definition libavrdude.h:298
int delay
Definition libavrdude.h:299
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References AVR_OP_MAX, avr_op_str(), avrdude_message(), opcode::bit, cmdbit::bitno, bittype(), avrmem::blocksize, avrmem::delay, avrmem::desc, avrmem::max_write_delay, avrmem::min_write_delay, avrmem::mode, MSG_INFO, MSG_TRACE2, avrmem::num_pages, avrmem::op, avrmem::page_size, avrmem::paged, avrmem::pollindex, avrmem::readback, avrmem::size, cmdbit::type, cmdbit::value, and verbose.

Referenced by avr_display().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_new_memtype()

AVRMEM * avr_new_memtype ( void  )
249{
250 AVRMEM * m;
251
252 m = (AVRMEM *)malloc(sizeof(*m));
253 if (m == NULL) {
254 // avrdude_message(MSG_INFO, "avr_new_memtype(): out of memory\n");
255 // exit(1);
256 avrdude_oom("avr_new_memtype(): out of memory\n");
257 }
258
259 memset(m, 0, sizeof(*m));
260
261 return m;
262}

References avrdude_oom(), and malloc().

Referenced by avr_dup_mem(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_new_opcode()

OPCODE * avr_new_opcode ( void  )
34{
35 OPCODE * m;
36
37 m = (OPCODE *)malloc(sizeof(*m));
38 if (m == NULL) {
39 // avrdude_message(MSG_INFO, "avr_new_opcode(): out of memory\n");
40 // exit(1);
41 avrdude_oom("avr_new_opcode(): out of memory\n");
42 }
43
44 memset(m, 0, sizeof(*m));
45
46 return m;
47}

References avrdude_oom(), and malloc().

Referenced by yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_new_part()

AVRPART * avr_new_part ( void  )
444{
445 AVRPART * p;
446
447 p = (AVRPART *)malloc(sizeof(AVRPART));
448 if (p == NULL) {
449 // avrdude_message(MSG_INFO, "new_part(): out of memory\n");
450 // exit(1);
451 avrdude_oom("new_part(): out of memory\n");
452 }
453
454 memset(p, 0, sizeof(*p));
455
456 p->id[0] = 0;
457 p->desc[0] = 0;
461 p->config_file[0] = 0;
462 p->lineno = 0;
463 memset(p->signature, 0xFF, 3);
465 p->ocdrev = -1;
466
467 p->mem = lcreat(NULL, 0);
468
469 return p;
470}
enum ctl_stack_t ctl_stack_type
Definition libavrdude.h:243
int ocdrev
Definition libavrdude.h:273
LISTID lcreat(void *liststruct, int poolsize)
Definition lists.c:410
char id[AVR_IDLEN]
Definition libavrdude.h:219
@ CTL_STACK_NONE
Definition libavrdude.h:176
char config_file[PATH_MAX]
Definition libavrdude.h:278
unsigned char signature[3]
Definition libavrdude.h:225
int lineno
Definition libavrdude.h:279
@ PIN_AVR_SCK
Definition libavrdude.h:356
@ RESET_DEDICATED
Definition libavrdude.h:171
#define AVRPART_ENABLEPAGEPROGRAMMING
Definition libavrdude.h:200

References avrdude_oom(), AVRPART_ENABLEPAGEPROGRAMMING, AVRPART_PARALLELOK, AVRPART_SERIALOK, avrpart::config_file, CTL_STACK_NONE, avrpart::ctl_stack_type, avrpart::desc, avrpart::flags, avrpart::id, lcreat(), avrpart::lineno, malloc(), avrpart::mem, avrpart::ocdrev, PIN_AVR_SCK, RESET_DEDICATED, avrpart::reset_disposition, avrpart::retry_pulse, and avrpart::signature.

Referenced by avr_dup_part(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avr_op_str()

static char * avr_op_str ( int  op)
static
211{
212 switch (op) {
213 case AVR_OP_READ : return "READ"; break;
214 case AVR_OP_WRITE : return "WRITE"; break;
215 case AVR_OP_READ_LO : return "READ_LO"; break;
216 case AVR_OP_READ_HI : return "READ_HI"; break;
217 case AVR_OP_WRITE_LO : return "WRITE_LO"; break;
218 case AVR_OP_WRITE_HI : return "WRITE_HI"; break;
219 case AVR_OP_LOADPAGE_LO : return "LOADPAGE_LO"; break;
220 case AVR_OP_LOADPAGE_HI : return "LOADPAGE_HI"; break;
221 case AVR_OP_LOAD_EXT_ADDR : return "LOAD_EXT_ADDR"; break;
222 case AVR_OP_WRITEPAGE : return "WRITEPAGE"; break;
223 case AVR_OP_CHIP_ERASE : return "CHIP_ERASE"; break;
224 case AVR_OP_PGM_ENABLE : return "PGM_ENABLE"; break;
225 default : return "<unknown opcode>"; break;
226 }
227}
@ AVR_OP_PGM_ENABLE
Definition libavrdude.h:157
@ AVR_OP_WRITE_LO
Definition libavrdude.h:150
@ AVR_OP_WRITEPAGE
Definition libavrdude.h:155
@ AVR_OP_READ
Definition libavrdude.h:146
@ AVR_OP_LOADPAGE_LO
Definition libavrdude.h:152
@ AVR_OP_READ_LO
Definition libavrdude.h:148
@ AVR_OP_CHIP_ERASE
Definition libavrdude.h:156
@ AVR_OP_WRITE_HI
Definition libavrdude.h:151
@ AVR_OP_LOAD_EXT_ADDR
Definition libavrdude.h:154
@ AVR_OP_LOADPAGE_HI
Definition libavrdude.h:153
@ AVR_OP_READ_HI
Definition libavrdude.h:149
@ AVR_OP_WRITE
Definition libavrdude.h:147

References AVR_OP_CHIP_ERASE, AVR_OP_LOAD_EXT_ADDR, AVR_OP_LOADPAGE_HI, AVR_OP_LOADPAGE_LO, AVR_OP_PGM_ENABLE, AVR_OP_READ, AVR_OP_READ_HI, AVR_OP_READ_LO, AVR_OP_WRITE, AVR_OP_WRITE_HI, AVR_OP_WRITE_LO, and AVR_OP_WRITEPAGE.

Referenced by avr_mem_display().

+ Here is the caller graph for this function:

◆ avr_set_addr()

int avr_set_addr ( OPCODE op,
unsigned char *  cmd,
unsigned long  addr 
)
108{
109 int i, j, bit;
110 unsigned long value;
111 unsigned char mask;
112
113 for (i=0; i<32; i++) {
114 if (op->bit[i].type == AVR_CMDBIT_ADDRESS) {
115 j = 3 - i / 8;
116 bit = i % 8;
117 mask = 1 << bit;
118 value = addr >> op->bit[i].bitno & 0x01;
119 if (value)
120 cmd[j] = cmd[j] | mask;
121 else
122 cmd[j] = cmd[j] & ~mask;
123 }
124 }
125
126 return 0;
127}
@ AVR_CMDBIT_ADDRESS
Definition libavrdude.h:165
struct command cmd[]
Definition term.c:94

References AVR_CMDBIT_ADDRESS, opcode::bit, cmdbit::bitno, cmd, and cmdbit::type.

Referenced by avr_read_byte_default(), avr_write_byte_default(), avr_write_page(), buspirate_paged_write(), stk500_loadaddr(), stk500isp_read_byte(), and stk500isp_write_byte().

+ Here is the caller graph for this function:

◆ avr_set_bits()

int avr_set_bits ( OPCODE op,
unsigned char *  cmd 
)
81{
82 int i, j, bit;
83 unsigned char mask;
84
85 for (i=0; i<32; i++) {
86 if (op->bit[i].type == AVR_CMDBIT_VALUE) {
87 j = 3 - i / 8;
88 bit = i % 8;
89 mask = 1 << bit;
90 if (op->bit[i].value)
91 cmd[j] = cmd[j] | mask;
92 else
93 cmd[j] = cmd[j] & ~mask;
94 }
95 }
96
97 return 0;
98}
@ AVR_CMDBIT_VALUE
Definition libavrdude.h:164

References AVR_CMDBIT_VALUE, opcode::bit, cmd, cmdbit::type, and cmdbit::value.

Referenced by avr_read_byte_default(), avr_write_byte_default(), avr_write_page(), bitbang_chip_erase(), bitbang_program_enable(), buspirate_chip_erase(), buspirate_paged_write(), buspirate_program_enable(), stk500_chip_erase(), stk500_loadaddr(), stk500isp_read_byte(), stk500isp_write_byte(), stk500v2_chip_erase(), stk500v2_paged_load(), stk500v2_paged_write(), and stk500v2_program_enable().

+ Here is the caller graph for this function:

◆ avr_set_input()

int avr_set_input ( OPCODE op,
unsigned char *  cmd,
unsigned char  data 
)
137{
138 int i, j, bit;
139 unsigned char value;
140 unsigned char mask;
141
142 for (i=0; i<32; i++) {
143 if (op->bit[i].type == AVR_CMDBIT_INPUT) {
144 j = 3 - i / 8;
145 bit = i % 8;
146 mask = 1 << bit;
147 value = data >> op->bit[i].bitno & 0x01;
148 if (value)
149 cmd[j] = cmd[j] | mask;
150 else
151 cmd[j] = cmd[j] & ~mask;
152 }
153 }
154
155 return 0;
156}
@ AVR_CMDBIT_INPUT
Definition libavrdude.h:166

References AVR_CMDBIT_INPUT, opcode::bit, cmdbit::bitno, cmd, and cmdbit::type.

Referenced by avr_write_byte_default(), buspirate_paged_write(), and stk500isp_write_byte().

+ Here is the caller graph for this function:

◆ bittype()

static char * bittype ( int  type)
static
231{
232 switch (type) {
233 case AVR_CMDBIT_IGNORE : return "IGNORE"; break;
234 case AVR_CMDBIT_VALUE : return "VALUE"; break;
235 case AVR_CMDBIT_ADDRESS : return "ADDRESS"; break;
236 case AVR_CMDBIT_INPUT : return "INPUT"; break;
237 case AVR_CMDBIT_OUTPUT : return "OUTPUT"; break;
238 default : return "<unknown bit type>"; break;
239 }
240}
@ AVR_CMDBIT_IGNORE
Definition libavrdude.h:163

References AVR_CMDBIT_ADDRESS, AVR_CMDBIT_IGNORE, AVR_CMDBIT_INPUT, AVR_CMDBIT_OUTPUT, and AVR_CMDBIT_VALUE.

Referenced by avr_mem_display().

+ Here is the caller graph for this function:

◆ locate_part()

AVRPART * locate_part ( LISTID  parts,
char *  partdesc 
)
515{
516 LNODEID ln1;
517 AVRPART * p = NULL;
518 int found;
519
520 found = 0;
521
522 for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) {
523 p = ldata(ln1);
524 if ((strcasecmp(partdesc, p->id) == 0) ||
525 (strcasecmp(partdesc, p->desc) == 0))
526 found = 1;
527 }
528
529 if (found)
530 return p;
531
532 return NULL;
533}
struct avrpart parts[]
#define strcasecmp
Definition unistd.h:52

References avrpart::desc, avrpart::id, ldata(), lfirst(), lnext(), parts, and strcasecmp.

Referenced by avrdude_main(), and yyparse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locate_part_by_avr910_devcode()

AVRPART * locate_part_by_avr910_devcode ( LISTID  parts,
int  devcode 
)
536{
537 LNODEID ln1;
538 AVRPART * p = NULL;
539
540 for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
541 p = ldata(ln1);
542 if (p->avr910_devcode == devcode)
543 return p;
544 }
545
546 return NULL;
547}
int avr910_devcode
Definition libavrdude.h:221

References avrpart::avr910_devcode, ldata(), lfirst(), lnext(), and parts.

Referenced by avr910_initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locate_part_by_signature()

AVRPART * locate_part_by_signature ( LISTID  parts,
unsigned char *  sig,
int  sigsize 
)
551{
552 LNODEID ln1;
553 AVRPART * p = NULL;
554 int i;
555
556 if (sigsize == 3) {
557 for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
558 p = ldata(ln1);
559 for (i=0; i<3; i++)
560 if (p->signature[i] != sig[i])
561 break;
562 if (i == 3)
563 return p;
564 }
565 }
566
567 return NULL;
568}

References ldata(), lfirst(), lnext(), parts, and avrpart::signature.

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_disp_str()

static char * reset_disp_str ( int  r)
static
612{
613 switch (r) {
614 case RESET_DEDICATED : return "dedicated";
615 case RESET_IO : return "possible i/o";
616 default : return "<invalid>";
617 }
618}
@ RESET_IO
Definition libavrdude.h:172

References RESET_DEDICATED, and RESET_IO.

Referenced by avr_display().

+ Here is the caller graph for this function:

◆ sort_avrparts()

void sort_avrparts ( LISTID  avrparts)
606{
607 lsort(avrparts,(int (*)(void*, void*)) sort_avrparts_compare);
608}
static int sort_avrparts_compare(AVRPART *p1, AVRPART *p2)
Definition avrpart.c:594
void lsort(LISTID lid, int(*compare)(void *p1, void *p2))
Definition lists.c:1289

References lsort(), and sort_avrparts_compare().

Referenced by list_parts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_avrparts_compare()

static int sort_avrparts_compare ( AVRPART p1,
AVRPART p2 
)
static
595{
596 if(p1 == NULL || p2 == NULL) {
597 return 0;
598 }
599 return strncasecmp(p1->desc,p2->desc,AVR_DESCLEN);
600}
#define AVR_DESCLEN
Definition libavrdude.h:209
#define strncasecmp
Definition unistd.h:51

References AVR_DESCLEN, avrpart::desc, and strncasecmp.

Referenced by sort_avrparts().

+ Here is the caller graph for this function:

◆ walk_avrparts()

void walk_avrparts ( LISTID  avrparts,
walk_avrparts_cb  cb,
void cookie 
)
581{
582 LNODEID ln1;
583 AVRPART * p;
584
585 for (ln1 = lfirst(avrparts); ln1; ln1 = lnext(ln1)) {
586 p = ldata(ln1);
587 cb(p->id, p->desc, p->config_file, p->lineno, cookie);
588 }
589}

References avrpart::config_file, avrpart::desc, avrpart::id, ldata(), lfirst(), avrpart::lineno, and lnext().

Referenced by list_parts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: