From 292947d9a888e0a080bcfd35903f0fd2f1463061 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 10 May 2024 10:29:38 +0100 Subject: [PATCH] Put static variable of ppi.c into context structure --- src/libavrdude.h | 3 +++ src/ppi.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libavrdude.h b/src/libavrdude.h index c53cf429..3411c1b8 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -1564,6 +1564,9 @@ typedef struct { // Static variable from config_gram.y int cfgy_pin_name; // Temporary variable for grammar parsing + + // Static variable from ppi.c + unsigned char ppi_shadow[3]; } cx_t; extern cx_t *cx; diff --git a/src/ppi.c b/src/ppi.c index ef2c9ef9..e883553f 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -54,7 +54,6 @@ enum { static int ppi_shadow_access(const union filedescriptor *fdp, int reg, unsigned char *v, unsigned char action) { - static unsigned char shadow[3]; int shadow_num; switch (reg) { @@ -75,14 +74,14 @@ static int ppi_shadow_access(const union filedescriptor *fdp, int reg, switch (action) { case PPI_SHADOWREAD: - *v = shadow[shadow_num]; + *v = cx->ppi_shadow[shadow_num]; break; case PPI_READ: DO_PPI_READ(fdp->ifd, reg, v); - shadow[shadow_num]=*v; + cx->ppi_shadow[shadow_num]=*v; break; case PPI_WRITE: - shadow[shadow_num]=*v; + cx->ppi_shadow[shadow_num]=*v; DO_PPI_WRITE(fdp->ifd, reg, v); break; }