Add parent id output for developer options -p*/s for parts
This commit is contained in:
parent
1549273529
commit
78754b8ccc
|
@ -354,7 +354,6 @@ AVRMEM_ALIAS * avr_dup_memalias(AVRMEM_ALIAS * m)
|
|||
|
||||
void avr_free_mem(AVRMEM * m)
|
||||
{
|
||||
int i;
|
||||
if (m->buf != NULL) {
|
||||
free(m->buf);
|
||||
m->buf = NULL;
|
||||
|
@ -363,7 +362,7 @@ void avr_free_mem(AVRMEM * m)
|
|||
free(m->tags);
|
||||
m->tags = NULL;
|
||||
}
|
||||
for(i=0;i<sizeof(m->op)/sizeof(m->op[0]);i++)
|
||||
for(size_t i=0; i<sizeof(m->op)/sizeof(m->op[0]); i++)
|
||||
{
|
||||
if (m->op[i] != NULL)
|
||||
{
|
||||
|
@ -487,7 +486,8 @@ AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig)
|
|||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
|
||||
int type, int verbose)
|
||||
{
|
||||
static unsigned int prev_mem_offset, prev_mem_size;
|
||||
static unsigned int prev_mem_offset;
|
||||
static int prev_mem_size;
|
||||
int i, j;
|
||||
char * optr;
|
||||
|
||||
|
@ -579,6 +579,7 @@ AVRPART * avr_new_part(void)
|
|||
p->reset_disposition = RESET_DEDICATED;
|
||||
p->retry_pulse = PIN_AVR_SCK;
|
||||
p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING;
|
||||
p->parent_id = NULL;
|
||||
p->config_file = NULL;
|
||||
p->lineno = 0;
|
||||
memset(p->signature, 0xFF, 3);
|
||||
|
@ -608,7 +609,6 @@ AVRPART * avr_dup_part(AVRPART * d)
|
|||
|
||||
p->mem = save;
|
||||
p->mem_alias = save2;
|
||||
|
||||
for (ln=lfirst(d->mem); ln; ln=lnext(ln)) {
|
||||
AVRMEM *m = ldata(ln);
|
||||
AVRMEM *m2 = avr_dup_mem(m);
|
||||
|
@ -636,15 +636,13 @@ AVRPART * avr_dup_part(AVRPART * d)
|
|||
|
||||
void avr_free_part(AVRPART * d)
|
||||
{
|
||||
int i;
|
||||
ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem);
|
||||
d->mem = NULL;
|
||||
ldestroy_cb(d->mem_alias, (void(*)(void *))avr_free_memalias);
|
||||
d->mem_alias = NULL;
|
||||
for(i=0;i<sizeof(d->op)/sizeof(d->op[0]);i++)
|
||||
{
|
||||
if (d->op[i] != NULL)
|
||||
{
|
||||
/* do not free d->parent_id and d->config_file */
|
||||
for(size_t i=0; i<sizeof(d->op)/sizeof(d->op[0]); i++) {
|
||||
if (d->op[i] != NULL) {
|
||||
avr_free_opcode(d->op[i]);
|
||||
d->op[i] = NULL;
|
||||
}
|
||||
|
|
|
@ -334,6 +334,7 @@ prog_decl :
|
|||
free_token($3);
|
||||
YYABORT;
|
||||
}
|
||||
current_prog->parent_id = cache_string($3->value.string);
|
||||
current_prog->config_file = cache_string(cfg_infile);
|
||||
current_prog->lineno = cfg_lineno;
|
||||
free_token($3);
|
||||
|
@ -425,6 +426,7 @@ part_decl :
|
|||
free_token($3);
|
||||
YYABORT;
|
||||
}
|
||||
current_part->parent_id = cache_string($3->value.string);
|
||||
current_part->config_file = cache_string(cfg_infile);
|
||||
current_part->lineno = cfg_lineno;
|
||||
|
||||
|
|
|
@ -592,6 +592,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) {
|
|||
|
||||
d->base = *p;
|
||||
|
||||
d->base.parent_id = NULL;
|
||||
d->base.config_file = NULL;
|
||||
d->base.lineno = 0;
|
||||
|
||||
|
@ -678,6 +679,9 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) {
|
|||
dev_info("#------------------------------------------------------------\n");
|
||||
dev_info("# %s\n", p->desc);
|
||||
dev_info("#------------------------------------------------------------\n");
|
||||
if(p->parent_id)
|
||||
dev_info("\npart parent \"%s\"\n", p->parent_id);
|
||||
else
|
||||
dev_info("\npart\n");
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1051,7 @@ void dev_output_part_defs(char *partdesc) {
|
|||
continue;
|
||||
|
||||
if(strct || cmpst)
|
||||
dev_part_strct(p, tsv, cmpst? nullpart: NULL);
|
||||
dev_part_strct(p, tsv, !cmpst? NULL: p->parent_id? locate_part(part_list, p->parent_id): nullpart);
|
||||
|
||||
if(raw)
|
||||
dev_part_raw(p);
|
||||
|
|
|
@ -217,6 +217,7 @@ typedef struct opcode {
|
|||
typedef struct avrpart {
|
||||
char desc[AVR_DESCLEN]; /* long part name */
|
||||
char id[AVR_IDLEN]; /* short part name */
|
||||
char * parent_id; /* parent id if set, for -p.../s */
|
||||
char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */
|
||||
int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */
|
||||
int stk500_devcode; /* stk500 device code */
|
||||
|
@ -661,6 +662,7 @@ typedef struct programmer_t {
|
|||
char desc[PGM_DESCLEN];
|
||||
char type[PGM_TYPELEN];
|
||||
char port[PGM_PORTLEN];
|
||||
char *parent_id;
|
||||
void (*initpgm)(struct programmer_t * pgm);
|
||||
unsigned int pinno[N_PINS];
|
||||
struct pindef_t pin[N_PINS];
|
||||
|
|
|
@ -79,6 +79,7 @@ PROGRAMMER * pgm_new(void)
|
|||
pgm->usbpid = lcreat(NULL, 0);
|
||||
pgm->desc[0] = 0;
|
||||
pgm->type[0] = 0;
|
||||
pgm->parent_id = NULL;
|
||||
pgm->config_file = NULL;
|
||||
pgm->lineno = 0;
|
||||
pgm->baudrate = 0;
|
||||
|
@ -145,11 +146,8 @@ void pgm_free(PROGRAMMER * const p)
|
|||
ldestroy_cb(p->usbpid, free);
|
||||
p->id = NULL;
|
||||
p->usbpid = NULL;
|
||||
/* this is done by pgm_teardown, but usually cookie is not set to NULL */
|
||||
/* if (p->cookie !=NULL) {
|
||||
free(p->cookie);
|
||||
p->cookie = NULL;
|
||||
}*/
|
||||
/* do not free p->parent_id nor p->config_file */
|
||||
/* p->cookie is freed by pgm_teardown */
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
@ -169,7 +167,6 @@ PROGRAMMER * pgm_dup(const PROGRAMMER * const src)
|
|||
|
||||
pgm->id = lcreat(NULL, 0);
|
||||
pgm->usbpid = lcreat(NULL, 0);
|
||||
|
||||
for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) {
|
||||
int *ip = malloc(sizeof(int));
|
||||
if (ip == NULL) {
|
||||
|
|
Loading…
Reference in New Issue