Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NVM driver signature handling

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.

Data Structures

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

Macros

#define nvm_get_production_signature_row_offset(regname)   offsetof(NVM_PROD_SIGNATURES_t, regname)
 Get offset of calibration bytes in the production signature row. More...
 

Functions

static void nvm_read_device_id (struct nvm_device_id *storage)
 Read the device id. More...
 
static uint8_t nvm_read_device_rev (void)
 Read the device revision. More...
 
void nvm_read_device_serial (struct nvm_device_serial *storage)
 Read the device serial. More...
 
static uint8_t nvm_read_production_signature_row (uint8_t address)
 Read one byte from the production signature row. More...
 
static uint8_t nvm_read_user_signature_row (uint16_t address)
 Read one byte from the user signature row. More...
 

#define nvm_get_production_signature_row_offset (   regname)    offsetof(NVM_PROD_SIGNATURES_t, regname)

Get offset of calibration bytes in the production signature row.

Parameters
regnameName of register within the production signature row
Return values
Offsetof register into the production signature row

Referenced by nvm_read_device_serial(), and sysclk_init().

static void nvm_read_device_id ( struct nvm_device_id storage)
inlinestatic

Read the device id.

This function returns the device ID stored in the device.

Return values
storagePointer to the structure where to store the device id

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

Referenced by main(), and run_device_id_test().

static uint8_t nvm_read_device_rev ( void  )
inlinestatic

Read the device revision.

This function returns the device revision stored in the device.

Return values
unsigned8 bit value with the current device revision.
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
storagePointer to the structure where to store the device serial

References nvm_device_serial::coordx0, nvm_device_serial::coordx1, nvm_device_serial::coordy0, nvm_device_serial::coordy1, nvm_device_serial::lotnum0, nvm_device_serial::lotnum1, nvm_device_serial::lotnum2, nvm_device_serial::lotnum3, nvm_device_serial::lotnum4, nvm_device_serial::lotnum5, nvm_get_production_signature_row_offset, nvm_read_production_signature_row(), and nvm_device_serial::wafnum.

Referenced by main(), and run_device_serial_test().

static uint8_t nvm_read_production_signature_row ( uint8_t  address)
inlinestatic

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
addressByte offset into the signature row

References nvm_read_byte().

Referenced by adc_get_calibration_data(), dac_get_calibration_data(), nvm_read_device_serial(), and sysclk_init().

static uint8_t nvm_read_user_signature_row ( uint16_t  address)
inlinestatic

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
addressByte offset into the signature row

References nvm_read_byte().

Referenced by is_user_sig_equal_to_buffer(), nvm_user_sig_read_buffer(), and nvm_user_sig_write_buffer().