FLASHCALW example1 for SAM.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
Data Structures | |
struct | nvram_data_t |
Macros | |
#define | NVRAM_PAGE_ADDRESS (FLASH_ADDR + FLASH_SIZE - FLASH_PAGE_SIZE) |
#define | NVRAM_PAGE_NUMBER (NVRAM_PAGE_ADDRESS/FLASH_PAGE_SIZE) |
#define | USER_PAGE_ADDRESS (FLASH_USER_PAGE_ADDR + 8) |
Functions | |
static void | configure_console (void) |
Configure serial console. More... | |
static void | flash_protect_example (void) |
This is an example demonstrating the flash lock bits feature. More... | |
static void | flash_rw_example (const char *caption, nvram_data_t *nvram_data) |
This is an example demonstrating flash read / write data accesses using the FLASHCALW driver. More... | |
int | main (void) |
main function : perform several read/write accesses to the flash then lock and unlock a page in the flash. More... | |
static void | print_nvram_variables (nvram_data_t *nvram_data) |
Prints the variables stored in NVRAM. More... | |
#define NVRAM_PAGE_ADDRESS (FLASH_ADDR + FLASH_SIZE - FLASH_PAGE_SIZE) |
Referenced by flash_protect_example(), and main().
#define NVRAM_PAGE_NUMBER (NVRAM_PAGE_ADDRESS/FLASH_PAGE_SIZE) |
Referenced by flash_protect_example().
#define USER_PAGE_ADDRESS (FLASH_USER_PAGE_ADDR + 8) |
Referenced by main().
|
static |
Configure serial console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, and stdio_serial_init().
Referenced by main().
|
static |
This is an example demonstrating the flash lock bits feature.
References FLASH_PAGE_SIZE, flashcalw_is_lock_error(), flashcalw_lock_page_region(), flashcalw_memset, NVRAM_PAGE_ADDRESS, and NVRAM_PAGE_NUMBER.
Referenced by main().
|
static |
This is an example demonstrating flash read / write data accesses using the FLASHCALW driver.
caption | Caption to print before running the example. |
nvram_data | Pointer to the NVRAM data structure to use in the example. |
References flashcalw_memcpy(), flashcalw_memset, print_nvram_variables(), nvram_data_t::var16, nvram_data_t::var32, nvram_data_t::var8, and nvram_data_t::var8_3.
Referenced by main().
int main | ( | void | ) |
main function : perform several read/write accesses to the flash then lock and unlock a page in the flash.
References board_init(), BOARD_NAME, CONF_UART, configure_console(), flash_protect_example(), flash_rw_example(), flashcalw_set_security_bit(), NVRAM_PAGE_ADDRESS, sysclk_init(), usart_read(), and USER_PAGE_ADDRESS.
|
static |
Prints the variables stored in NVRAM.
nvram_data | Pointer to the NVRAM data structure to print. |
References nvram_data_t::var16, nvram_data_t::var32, nvram_data_t::var8, and nvram_data_t::var8_3.
Referenced by flash_rw_example().