diff -cr ../uisp-20050207/src/Avr.h ../uisp-new/src/Avr.h
*** ../uisp-20050207/src/Avr.h	Wed Mar 31 06:25:44 2004
--- ../uisp-new/src/Avr.h	Wed Mar  9 19:09:08 2005
***************
*** 213,218 ****
--- 213,221 ----
    /* Read byte description at address addr (as security bits) */
    const char* ReadByteDescription(TAddr addr);
    
+     virtual TByte ReadCalByte(TByte addr) = 0;
+ 
+   
    TAvr();
    ~TAvr();
  };
diff -cr ../uisp-20050207/src/AvrAtmel.h ../uisp-new/src/AvrAtmel.h
*** ../uisp-20050207/src/AvrAtmel.h	Sat May 25 21:59:46 2002
--- ../uisp-new/src/AvrAtmel.h	Thu Mar 10 01:34:24 2005
***************
*** 62,68 ****
    void WriteProgramMemoryPage();
    TByte ReadFuseLowBits ();
    TByte ReadFuseHighBits ();
-   TByte ReadCalByte(TByte addr);
    TByte ReadFuseExtBits ();
    TByte ReadLockFuseBits ();
    TByte ReadLockBits ();
--- 62,67 ----
***************
*** 84,89 ****
--- 83,91 ----
  
    /* Write lock bits */
    void WriteLockBits(TByte bits);
+ 
+   /* calibration bytes */
+   TByte ReadCalByte(TByte addr);
    
    TAvrAtmel();
    ~TAvrAtmel();
diff -cr ../uisp-20050207/src/AvrDummy.h ../uisp-new/src/AvrDummy.h
*** ../uisp-20050207/src/AvrDummy.h	Sat May 25 21:59:46 2002
--- ../uisp-new/src/AvrDummy.h	Thu Mar 10 01:34:54 2005
***************
*** 45,51 ****
    TByte ReadFuseLowBits();
    TByte ReadFuseHighBits();
    TByte ReadFuseExtBits();
-   TByte ReadCalByte(TByte addr);
    void WriteOldFuseBits(TByte val);  /* 5 bits */
    void WriteFuseLowBits(TByte val);
    void WriteFuseHighBits(TByte val);
--- 45,50 ----
***************
*** 72,77 ****
--- 71,79 ----
    float GetTotPollTime();
    float GetMaxPollTime();
    void ResetMinMax();
+ 
+   /* calibration bytes */
+   TByte ReadCalByte(TByte addr);
    
    TAvrDummy();
    ~TAvrDummy(){}
diff -cr ../uisp-20050207/src/Global.h ../uisp-new/src/Global.h
*** ../uisp-20050207/src/Global.h	Mon Oct 11 22:21:02 2004
--- ../uisp-new/src/Global.h	Thu Mar 10 01:27:44 2005
***************
*** 104,109 ****
--- 104,112 ----
    virtual void WriteLockBits(TByte bits)=0;
    virtual TByte ReadLockBits(){return 0;}
    
+   /* calibration bytes */
+   virtual TByte ReadCalByte(TByte addr) = 0;
+ 
    /* Transfer Statistics in Bytes/Seconds */
    virtual unsigned int GetPollCount(){return 0;}
    virtual float GetMinPollTime(){return 0;}
diff -cr ../uisp-20050207/src/Main.C ../uisp-new/src/Main.C
*** ../uisp-20050207/src/Main.C	Tue Dec 28 17:39:38 2004
--- ../uisp-new/src/Main.C	Thu Mar 10 01:41:30 2005
***************
*** 161,166 ****
--- 161,167 ----
  "\n"
  "Fuse/Lock Bit Operations:\n"
  "  --rd_fuses   Read all fuses and print values to stdout\n"
+ "  --rd_cal=N   Read N calibration bytes and print values (min/max: 1/4)\n"
  "  --wr_fuse_l  Write fuse low byte\n"
  "  --wr_fuse_h  Write fuse high byte\n"
  "  --wr_fuse_e  Write fuse extended byte\n"
***************
*** 334,340 ****
        printf("Fuse Low Byte      = 0x%02x\n", device->ReadByte(AVR_FUSE_LOW_ADDR));
        printf("Fuse High Byte     = 0x%02x\n", device->ReadByte(AVR_FUSE_HIGH_ADDR));
        printf("Fuse Extended Byte = 0x%02x\n", device->ReadByte(AVR_FUSE_EXT_ADDR));
!       printf("Calibration Byte   = 0x%02x  --  Read Only\n",
               device->ReadByte(AVR_CAL_ADDR));
  
        bits = device->ReadByte(AVR_LOCK_ADDR);
--- 335,341 ----
        printf("Fuse Low Byte      = 0x%02x\n", device->ReadByte(AVR_FUSE_LOW_ADDR));
        printf("Fuse High Byte     = 0x%02x\n", device->ReadByte(AVR_FUSE_HIGH_ADDR));
        printf("Fuse Extended Byte = 0x%02x\n", device->ReadByte(AVR_FUSE_EXT_ADDR));
!       printf("Calibration Byte 0 = 0x%02x (Read Only, for more calibration bytes use --rd_cal)\n",
               device->ReadByte(AVR_CAL_ADDR));
  
        bits = device->ReadByte(AVR_LOCK_ADDR);
***************
*** 351,356 ****
--- 352,369 ----
        device->SetSegment(old_seg);
      }
  
+     if ((val=GetCmdParam("--rd_cal")) != NULL)
+     {
+         TByte Calibtion_bytes;
+         Calibtion_bytes = atoi(val);
+         if(!((Calibtion_bytes>=1) && (Calibtion_bytes<=4)))
+             throw Error_Device("Invalid argument for --rd_cal.");
+ 
+         for( int i=0;i<Calibtion_bytes; i++)
+             printf("Calibration Byte %2d = 0x%02x \n", i, device->ReadCalByte(i));
+ 
+     }
+ 
      if ((val=GetCmdParam("--wr_fuse_l")) != NULL)
      {
        unsigned int bits;
diff -cr ../uisp-20050207/src/Stk500.C ../uisp-new/src/Stk500.C
*** ../uisp-20050207/src/Stk500.C	Tue Dec 28 17:54:12 2004
--- ../uisp-new/src/Stk500.C	Wed Mar  9 19:13:04 2005
***************
*** 312,318 ****
  
        case AVR_CAL_ADDR:
          if (TestFeatures(AVR_CAL_RD))
!           val = ReadCalFuseBits(0);
          else
            Info (1, "Cannot read calibration byte on this device. "
                  "Returning 0xff\n");
--- 312,318 ----
  
        case AVR_CAL_ADDR:
          if (TestFeatures(AVR_CAL_RD))
!           val = ReadCalByte(0);
          else
            Info (1, "Cannot read calibration byte on this device. "
                  "Returning 0xff\n");
***************
*** 516,522 ****
  }
  
  
! TByte TStk500::ReadCalFuseBits(int addr)
  {
    TByte cmd[] = { 0x38, 0x00, addr, 0x00 };
  
--- 516,522 ----
  }
  
  
! TByte TStk500::ReadCalByte(TByte addr)
  {
    TByte cmd[] = { 0x38, 0x00, addr, 0x00 };
  
diff -cr ../uisp-20050207/src/Stk500.h ../uisp-new/src/Stk500.h
*** ../uisp-20050207/src/Stk500.h	Thu May 20 21:10:06 2004
--- ../uisp-new/src/Stk500.h	Thu Mar 10 01:35:16 2005
***************
*** 143,149 ****
    TByte UniversalCmd(TByte cmd[]);
  
    TByte ReadLockFuseBits();
-   TByte ReadCalFuseBits(int addr);
    TByte ReadFuseLowBits();
    TByte ReadFuseHighBits();
    TByte ReadFuseExtBits();
--- 143,148 ----
***************
*** 169,174 ****
--- 168,176 ----
    /* Write lock bits */
    void WriteLockBits(TByte bits);
  
+   /* calibration bytes */
+   TByte ReadCalByte(TByte addr);
+ 
    TStk500();
    ~TStk500();
  };
