avarice icon indicating copy to clipboard operation
avarice copied to clipboard

[patch #3] Daisy chain support (for both mkI & mkII)

Open avrs-admin opened this issue 3 years ago • 8 comments

flecxie <None> 2005-06-07 09:05:00

This patch adds support for daisy chains on the mkI.

avarice-daisy2.patch

This issue was migrated from https://sourceforge.net/p/avarice/patches/3/

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

flecxie 2005-06-14 19:27:09

Logged In: YES user_id=235907

This patch adds a config line to enable support for daisy chains.

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

flecxie 2005-06-14 19:27:09

  • summary: Daisy chain support for mkI --> Daisy chain support (for both mkI & mkII)

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

joerg_wunsch 2005-11-29 06:14:26

  • assigned_to: nobody --> joerg_wunsch

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

joerg_wunsch 2005-11-29 06:14:26

Logged In: YES user_id=1097648

I'm ready to deal with it, but SourceForge doesn't give me the download file anymore. :-(

Can you pleaese resubmit it?

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

flecxie 2006-04-07 09:32:45

Patch for both mkI and mkII to get avarice to work with daisy chains

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

flecxie 2006-04-07 09:32:45

Logged In: YES user_id=235907

Hi,

I just noticed your answer because I was looking for my own patch again ;)

I can however still download it here, but I'll add it in plaintext:

diff -r -u avarice-orig/src/jtag1.h avarice-patch/src/jtag1.h --- avarice-orig/src/jtag1.h 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/jtag1.h 2005-06-14 21:20:47.000000000 +0200 @@ -81,6 +81,7 @@ virtual bool synchroniseAt(int bitrate); virtual void startJtagLink(void); virtual void deviceAutoConfig(void);

  • virtual void configDaisyChain(void);

uchar *getJtagResponse(int responseSize); SendResult sendJtagCommand(uchar *command, int commandSize, int *tries); diff -r -u avarice-orig/src/jtag2.h avarice-patch/src/jtag2.h --- avarice-orig/src/jtag2.h 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/jtag2.h 2005-06-14 21:20:47.000000000 +0200 @@ -76,6 +76,7 @@ virtual bool synchroniseAt(int bitrate); virtual void startJtagLink(void); virtual void deviceAutoConfig(void);

  • virtual void configDaisyChain(void);

void sendFrame(uchar *command, int commandSize); int recvFrame(unsigned char *&msg, unsigned short &seqno); diff -r -u avarice-orig/src/jtag2io.cc avarice-patch/src/jtag2io.cc --- avarice-orig/src/jtag2io.cc 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/jtag2io.cc 2005-06-14 21:20:47.000000000 +0200 @@ -485,6 +485,9 @@ // Auto config debugOut("Automatic device detection: ");

  • /* Set daisy chain information */
  • configDaisyChain();

/* Read in the JTAG device ID to determine device */ getJtagParameter(PAR_JTAGID, resp, respSize); jtagCheck(respSize == 4); @@ -639,3 +642,20 @@ setJtagParameter(PAR_TIMERS_RUNNING, &timers, 1); resetProgram(); } + +void jtag2::configDaisyChain(void) +{

  • unsigned char buf[4];
  • if((dchain.units_before>0) ||
  •   (dchain.units_after>0) ||
    
  •   (dchain.bits_before>0) ||
    
  •   (dchain.bits_after>0) ){
    
  •       buf\[0\] = dchain.units_before;
    
  •       buf\[1\] = dchain.units_after;
    
  •       buf\[2\] = dchain.bits_before;
    
  •       buf\[3\] = dchain.bits_after;
    
  •       setJtagParameter(PAR_DAISY_CHAIN_INFO, buf, 4); 
    
  • } +}

diff -r -u avarice-orig/src/jtag.h avarice-patch/src/jtag.h --- avarice-orig/src/jtag.h 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/jtag.h 2005-06-14 21:20:47.000000000 +0200 @@ -624,6 +624,14 @@ // Name of the device controlled by the JTAG ICE char *device_name;

  • // Daisy chain info
  • struct{
  • unsigned char units_before;
  • unsigned char units_after;
  • unsigned char bits_before;
  • unsigned char bits_after;
  • } dchain;

protected: int safewrite(const void *b, int count); void changeLocalBitRate(int newBitRate); diff -r -u avarice-orig/src/jtagio.cc avarice-patch/src/jtagio.cc --- avarice-orig/src/jtagio.cc 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/jtagio.cc 2005-06-14 21:20:47.000000000 +0200 @@ -313,6 +313,9 @@

// Auto config debugOut("Automatic device detection: "); +

  • /* Set daisy chain information */
  • configDaisyChain();

/* Read in the JTAG device ID to determine device */ device_id = getJtagParameter(JTAG_P_JTAGID_BYTE0); @@ -477,3 +480,17 @@ setJtagParameter(JTAG_P_TIMERS_RUNNING, 0x00); resetProgram(); } + +void jtag1::configDaisyChain(void) +{

  • /* Set daisy chain information (if needed) */
  • if(dchain.units_before>0)

setJtagParameter(JTAG_P_UNITS_BEFORE,dchain.units_before);

  • if(dchain.units_after>0)

setJtagParameter(JTAG_P_UNITS_BEFORE,dchain.units_before);

  • if(dchain.units_after>0)
  •   setJtagParameter(JTAG_P_UNITS_AFTER,dchain.units_after);
    
  • if(dchain.bits_before>0)
  •   setJtagParameter(JTAG_P_BIT_BEFORE,dchain.bits_before);
    
  • if(dchain.bits_after>0)
  •   setJtagParameter(JTAG_P_BIT_AFTER,dchain.bits_after);
    

+} + diff -r -u avarice-orig/src/main.cc avarice-patch/src/main.cc --- avarice-orig/src/main.cc 2005-06-14 21:20:03.000000000 +0200 +++ avarice-patch/src/main.cc 2005-06-14 21:22:08.000000000 +0200 @@ -179,6 +179,9 @@ " -l, --read-lockbits Read lock bits.\n"); fprintf(stderr, " -L, --write-lockbits Write lock bits.\n");

  • fprintf(stderr,
  •       "  -c, --daisy-chain <c,c,c,c> Daisy chain
    

settings:\n"

  •       "                                <units before,
    

units after, bits before, bits after>\n"); fprintf(stderr, " -P, --part Target device name (e.g." " atmega16)\n\n"); @@ -212,6 +215,7 @@ { "detach", 0, 0, 'D' }, { "capture", 0, 0, 'C' }, { "file", 1, 0, 'f' },

  • { "daisy-chain", 1, 0, 'c'}, { 0, 0, 0, 0 } };

@@ -243,6 +247,10 @@ char *progname = argv[0]; int protocol = 1; // default to mkI protocol int option_index;

  • unsigned int units_before = 0;
  • unsigned int units_after = 0;
  • unsigned int bits_before = 0;
  • unsigned int bits_after = 0;

statusOut("AVaRICE version %s, %s %s\n\n", PACKAGE_VERSION, DATE, TIME); @@ -253,7 +261,7 @@

while (1) {

  •    int c = getopt_long (argc, argv,
    

"12VhdDCIf:j:B:pverW:lL:P:",

  •    int c = getopt_long (argc, argv,
    

"12VhdDCIf:j:B:pverW:lL:P:c:", long_opts, &option_index); if (c == -1) break; /* no more options */ @@ -315,8 +323,11 @@ case 'P': device_name = optarg; break;

  •   case 'V':
    
  •   exit(0);
    
  •       case 'c':
    

sscanf(optarg,"%u,%u,%u,%u",&units_before,&units_after,&bits_before,&bits_after);

  •           break;
    
  •       case 'V':
    
  •           exit(0);
    

default: fprintf (stderr, "getop() did something screwey"); exit (1); @@ -407,6 +418,12 @@ exit(1); }

  • /* Set Daisy-chain variables */
  • theJtagICE->dchain.units_before = (unsigned char) units_before;
  • theJtagICE->dchain.units_after = (unsigned char) units_after;
  • theJtagICE->dchain.bits_before = (unsigned char) bits_before;
  • theJtagICE->dchain.bits_after = (unsigned char) bits_after;

// Init JTAG box. theJtagICE->initJtagBox(); }

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

joerg_wunsch 2006-04-07 12:25:46

  • status: open --> closed-accepted

avrs-admin avatar Jan 26 '22 21:01 avrs-admin

joerg_wunsch 2006-04-07 12:25:46

Logged In: YES user_id=1097648

OK, this time, SourceForge allowed me to fetch the patch again as well.

Thanks for the reminder, I applied your patch with minor cosmetical changes. I notice avarice.1 needs to be updated as well, but I'll handle that myself later.

avrs-admin avatar Jan 26 '22 21:01 avrs-admin