avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #27198] avr/iox128a1.h is missing definitions fo


From: Simon Küppers
Subject: Re: [avr-libc-dev] [bug #27198] avr/iox128a1.h is missing definitions for calibration signature indexes
Date: Fri, 07 Aug 2009 14:01:19 +0200
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Still there are no defines or enums. The type you mentioned is a struct. But I can't see the advantage of a struct in this case. A Caller to the signature-row-read-function has to use offsetof() to define the index first.
So I think #defines would be appreciated.
Also I think, that it would be a good idea to include the read-calibration-byte functions in avr-libc so there is no need to implement these functions in each project sperately.

Mit freundlichen Grüßen

        Simon Küppers



Bob Paddock schrieb:
There are no #defines or enums defining an index for each possible
production/calibration signature row entry/register.

 NVM_PROD_SIGNATURES_t;?

/* Example of reading Product Signatures in C with standard XMega XML
header file: */

#include <stdint.h> /* uint8_t et.al */
#include <stddef.h> /* offsetof() */
#include <avr/io.h>

/* From application note AVR1316: */
#include "avr_compiler.h" /* Compile with GCC release of
WinAVR20090313 or newer */
#include "sp_driver.h"

/* Change hex8() to match what your hardware needs to display a byte */
#define hex8(x) do{ /* display byte here */ }while(0)

int main( void )
{
  /* Read the part signature and revision: */
  hex8( MCU.DEVID0 ); hex8( MCU.DEVID1 ); hex8( MCU.DEVID2 );
  hex8( (uint8_t) (MCU.REVID+'A') );

  /* Device serial number: */
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
LOTNUM0 ) ) ); /* First read after reset or possibly Power Up returns
zero */

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM1 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM2 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM3 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM4 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, LOTNUM5 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, WAFNUM ) )  );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDX0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDX1 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDY0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDY1 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
TEMPSENSE0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
TEMPSENSE1 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCACAL0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCACAL1 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCBCAL0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCBCAL1 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACAOFFCAL ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACACAINCAL ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACBOFFCAL ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACBGAINCAL ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, RCOSC2M ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, RCOSC32K ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, RCOSC32M ) ) );
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]