Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
In System Programming XMEGA implementation

This implementation links the XMEGA NVM functions to the common isp API.

Also, it manage :

Functions

static void mem_bootloader_read (void *dst, isp_addr_t src, uint16_t nbytes)
 Copy a bootloader version memory section to a RAM buffer. More...
 
static void mem_eeprom_read (void *dst, isp_addr_t src, uint16_t nbytes)
 Copy a eeprom memory section to a RAM buffer. More...
 
static void mem_eeprom_write (isp_addr_t dst, const void *src, uint16_t nbytes)
 Copy a RAM buffer to a eeprom memory section. More...
 
static void mem_flash_read (void *dst, isp_addr_t src, uint16_t nbytes)
 Copy a flash memory section to a RAM buffer. More...
 
static void mem_flash_write (isp_addr_t dst, const void *src, uint16_t nbytes)
 Copy a RAM buffer to a flash memory section. More...
 
static void mem_signature_read (void *dst, isp_addr_t src, uint16_t nbytes)
 Copy a signature memory section to a RAM buffer. More...
 

Variables

const isp_mem_t isp_bootloader
 Interface for memory bootloader version. More...
 
const isp_mem_t isp_eeprom
 Interface for memory eeprom. More...
 
const isp_mem_t isp_flash
 Interface for memory flash. More...
 
const isp_mem_t isp_no_available
 Interface for memory no available. More...
 
const isp_mem_t isp_signature
 Interface for memory signature. More...
 

Specific memories

static isp_mem_signature_t mem_signature
 Memory signature that stores information about the device. More...
 
static isp_mem_bootloader_t mem_bootloader
 Memory bootloader that stores the bootloader version. More...
 

Memories list declaration

const isp_mems_t isp_memories
 Memories list declaration. More...
 

Miscellaneous functions of the In System Programming module

void isp_init (void)
 Initializes the ISP interface. More...
 
bool isp_is_security (void)
 Gives the security state of the chip. More...
 
bool isp_erase_chip (void)
 Erase the application flash area and eventually the eeprom. More...
 
void isp_start_appli (void)
 Resets the device to start the user application. More...
 
void isp_force_boot_isp (bool force)
 Change the boot process configuration to enable/disable the ISP mode for the next startup. More...
 

bool isp_erase_chip ( void  )

Erase the application flash area and eventually the eeprom.

Returns
1 if function was successfully done, otherwise 0.

References nvm_eeprom_erase_all(), and nvm_flash_erase_app().

Referenced by udi_dfu_atmel_erase_chip().

void isp_force_boot_isp ( bool  force)

Change the boot process configuration to enable/disable the ISP mode for the next startup.

Parameters
forceEnable the ISP mode for the next startup if true

Referenced by udi_dfu_atmel_setup(), and udi_dfu_flip_msg_decode().

void isp_init ( void  )

Initializes the ISP interface.

Example, load the JTAG ID in signature memory

Referenced by udi_dfu_atmel_enable().

bool isp_is_security ( void  )

Gives the security state of the chip.

Returns
1 if chip is secured, otherwise 0.

Referenced by udi_dfu_atmel_enable().

void isp_start_appli ( void  )

Resets the device to start the user application.

The ISP mode must be disabled before (See isp_force_boot_isp(false)) to allow the boot process to jump to the user application.

Note
: this function is usually implemented by using a watchdog reset or a software reset to restart the CPU.

References ccp_write_io(), and cpu_irq_disable.

Referenced by udi_dfu_atmel_setup().

static void mem_bootloader_read ( void *  dst,
isp_addr_t  src,
uint16_t  nbytes 
)
static

Copy a bootloader version memory section to a RAM buffer.

Parameters
dstPointer to data destination.
srcPointer to source memory.
nbytesNumber of bytes to transfer.
static void mem_eeprom_read ( void *  dst,
isp_addr_t  src,
uint16_t  nbytes 
)
static

Copy a eeprom memory section to a RAM buffer.

Parameters
dstPointer to data destination.
srcPointer to source flash.
nbytesNumber of bytes to transfer.

References nvm_eeprom_read_buffer().

static void mem_eeprom_write ( isp_addr_t  dst,
const void *  src,
uint16_t  nbytes 
)
static

Copy a RAM buffer to a eeprom memory section.

Parameters
dstPointer to flash destination.
srcPointer to source data.
nbytesNumber of bytes to transfer.

References nvm_eeprom_erase_and_write_buffer(), and nvm_eeprom_write_byte().

static void mem_flash_read ( void *  dst,
isp_addr_t  src,
uint16_t  nbytes 
)
static

Copy a flash memory section to a RAM buffer.

Parameters
dstPointer to data destination.
srcPointer to source flash.
nbytesNumber of bytes to transfer.

References nvm_flash_read_buffer().

static void mem_flash_write ( isp_addr_t  dst,
const void *  src,
uint16_t  nbytes 
)
static

Copy a RAM buffer to a flash memory section.

Parameters
dstPointer to flash destination.
srcPointer to source data.
nbytesNumber of bytes to transfer.

References nvm_flash_erase_and_write_buffer().

static void mem_signature_read ( void *  dst,
isp_addr_t  src,
uint16_t  nbytes 
)
static

Copy a signature memory section to a RAM buffer.

Parameters
dstPointer to data destination.
srcPointer to source memory.
nbytesNumber of bytes to transfer.

const isp_mem_t isp_bootloader
Initial value:
= {
.size = sizeof(mem_bootloader),
.fnct_read = mem_bootloader_read,
.fnct_write = NULL,
}
static isp_mem_bootloader_t mem_bootloader
Memory bootloader that stores the bootloader version.
Definition: isp.c:77
static void mem_bootloader_read(void *dst, isp_addr_t src, uint16_t nbytes)
Copy a bootloader version memory section to a RAM buffer.
Definition: isp.c:149

Interface for memory bootloader version.

const isp_mem_t isp_eeprom
Initial value:
= {
.size = EEPROM_SIZE,
.fnct_read = mem_eeprom_read,
.fnct_write = mem_eeprom_write,
}
static void mem_eeprom_read(void *dst, isp_addr_t src, uint16_t nbytes)
Copy a eeprom memory section to a RAM buffer.
Definition: isp.c:115
static void mem_eeprom_write(isp_addr_t dst, const void *src, uint16_t nbytes)
Copy a RAM buffer to a eeprom memory section.
Definition: isp.c:127

Interface for memory eeprom.

const isp_mem_t isp_flash
Initial value:
= {
.size = FLASH_SIZE,
.fnct_read = mem_flash_read,
.fnct_write = mem_flash_write,
}
#define FLASH_SIZE
Size of a flash page in bytes.
Definition: nvm.h:447
static void mem_flash_read(void *dst, isp_addr_t src, uint16_t nbytes)
Copy a flash memory section to a RAM buffer.
Definition: isp.c:91
static void mem_flash_write(isp_addr_t dst, const void *src, uint16_t nbytes)
Copy a RAM buffer to a flash memory section.
Definition: isp.c:103

Interface for memory flash.

const isp_mems_t isp_memories
Initial value:
= {
.list = {
.flash = &isp_flash,
.eeprom = &isp_eeprom,
.security = &isp_no_available,
.conf = &isp_no_available,
.bootloader = &isp_bootloader,
.signature = &isp_signature,
.user = &isp_no_available,
.int_ram = &isp_no_available,
.ext_mem_cs0 = &isp_no_available,
.ext_mem_cs1 = &isp_no_available,
.ext_mem_cs2 = &isp_no_available,
.ext_mem_cs3 = &isp_no_available,
.ext_mem_cs4 = &isp_no_available,
.ext_mem_cs5 = &isp_no_available,
.ext_mem_cs6 = &isp_no_available,
.ext_mem_cs7 = &isp_no_available,
.ext_mem_df = &isp_no_available,
}
}
const isp_mem_t isp_flash
Interface for memory flash.
Definition: isp.c:167
const isp_mem_t isp_signature
Interface for memory signature.
Definition: isp.c:188
const isp_mem_t isp_no_available
Interface for memory no available.
Definition: isp.c:195
const isp_mem_t isp_eeprom
Interface for memory eeprom.
Definition: isp.c:174
const isp_mem_t isp_bootloader
Interface for memory bootloader version.
Definition: isp.c:181

Memories list declaration.

Referenced by udi_dfu_atmel_sel_mem().

const isp_mem_t isp_no_available
Initial value:
= {
.size = 0,
.fnct_read = NULL,
.fnct_write = NULL,
}

Interface for memory no available.

const isp_mem_t isp_signature
Initial value:
= {
.size = sizeof(mem_signature),
.fnct_read = mem_signature_read,
.fnct_write = NULL,
}
static isp_mem_signature_t mem_signature
Memory signature that stores information about the device.
Definition: isp.c:74
static void mem_signature_read(void *dst, isp_addr_t src, uint16_t nbytes)
Copy a signature memory section to a RAM buffer.
Definition: isp.c:161

Interface for memory signature.

isp_mem_bootloader_t mem_bootloader
static
Initial value:
= {
.version = BOOTLOADER_VERSION,
.id1 = 0,
.id2 = 0,
}
#define BOOTLOADER_VERSION
Definition: conf_isp.h:53

Memory bootloader that stores the bootloader version.

isp_mem_signature_t mem_signature
static

Memory signature that stores information about the device.