Xmega Application Note


NVM driver signature handling
[NVM driver]

Handling of signature rows. More...

Collaboration diagram for NVM driver signature handling:

Data Structures

struct  nvm_device_id
 Structure containing the device ID. More...
struct  nvm_device_serial
 Structure containing the device serial. More...

Functions

static void nvm_read_device_id (struct nvm_device_id *storage)
 Read the device id.
static uint8_t nvm_read_device_rev (void)
 Read the device revision.
void nvm_read_device_serial (struct nvm_device_serial *storage)
 Read the device serial.
static uint8_t nvm_read_production_signature_row (uint8_t address)
 Get offset of calibration bytes in the production signature row.
static uint8_t nvm_read_user_signature_row (uint8_t address)
 Read one byte from the user signature row.

Detailed Description

Handling of signature rows.

Functions for handling signature rows. The following is supported:

Note:
Some of these functions are modifying the NVM.CMD register. If the application are using program space access in interrupts (__flash pointers in IAR EW or pgm_read_byte in GCC) interrupts needs to be disabled when running EEPROM access functions. If not, the program space reads will be corrupted. See documentation for each individual function.
Do not use the functions of this module in an interrupt service routine (ISR), since the functions can take several milliseconds to complete and hence block the interrupt for several milliseconds. In addition the functions of this module are modifying the page buffer which will corrupt any ongoing EEPROM handing used outside an ISR.

Function Documentation

static void nvm_read_device_id ( struct nvm_device_id storage  )  [inline, static]

Read the device id.

This function returns the device ID stored in the device.

Return values:
storage Pointer to the structure where to store the device id

Definition at line 284 of file nvm.h.

References nvm_device_id::devid0, nvm_device_id::devid1, and nvm_device_id::devid2.

00285 {
00286         storage->devid0 = MCU.DEVID0;
00287         storage->devid1 = MCU.DEVID1;
00288         storage->devid2 = MCU.DEVID2;
00289 }

static uint8_t nvm_read_device_rev ( void   )  [inline, static]

Read the device revision.

This function returns the device revision stored in the device.

Return values:
storage Pointer to the structure where to store the device id

Definition at line 298 of file nvm.h.

00299 {
00300         return MCU.REVID;
00301 }

void nvm_read_device_serial ( struct nvm_device_serial storage  ) 

Read the device serial.

This function returns the device serial stored in the device.

Note:
This function is modifying the NVM.CMD register. If the application are using program space access in interrupts (__flash pointers in IAR EW or pgm_read_byte in GCC) interrupts needs to be disabled when running EEPROM access functions. If not the program space reads will be corrupted.
Return values:
storage Pointer to the structure where to store the device serial
static uint8_t nvm_read_production_signature_row ( uint8_t  address  )  [inline, static]

Get offset of calibration bytes in the production signature row.

Parameters:
regname Name of register within the production signature row
Return values:
Offset of register into the production signature row Read one byte from the production signature row This function reads one byte from the production signature row of the device at the given address.
Note:
This function is modifying the NVM.CMD register. If the application are using program space access in interrupts (__flash pointers in IAR EW or pgm_read_byte in GCC) interrupts needs to be disabled when running EEPROM access functions. If not the program space reads will be corrupted.
Parameters:
address Byte offset into the signature row

Definition at line 253 of file nvm.h.

References nvm_read_byte_near().

Referenced by adc_get_calibration_data(), and sysclk_init().

00254 {
00255         return nvm_read_byte_near(NVM_CMD_READ_CALIB_ROW_gc, address);
00256 }

Here is the call graph for this function:

static uint8_t nvm_read_user_signature_row ( uint8_t  address  )  [inline, static]

Read one byte from the user signature row.

This function reads one byte from the user signature row of the device at the given address.

Note:
This function is modifying the NVM.CMD register. If the application are using program space access in interrupts (__flash pointers in IAR EW or pgm_read_byte in GCC) interrupts needs to be disabled when running EEPROM access functions. If not the program space reads will be corrupted.
Parameters:
address Byte offset into the signature row

Definition at line 272 of file nvm.h.

References nvm_read_byte_near().

00273 {
00274         return nvm_read_byte_near(NVM_CMD_READ_USER_SIG_ROW_gc, address);
00275 }

Here is the call graph for this function:

@DOC_TITLE@
Generated on Fri Oct 22 12:15:26 2010 for AVR1300 Using the Xmega ADC by doxygen 1.6.3