Example of flash access using the FLASHCDW driver.
Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
#include "compiler.h"
#include "print_funcs.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "flashcdw.h"
Data Structures | |
struct | nvram_data_t |
Structure type containing variables to store in NVRAM using a specific memory map. More... | |
Macros | |
#define | EXAMPLE_TARGET_DFLL_FREQ_HZ 96000000 |
#define | EXAMPLE_TARGET_MCUCLK_FREQ_HZ 12000000 |
#define | EXAMPLE_TARGET_PBACLK_FREQ_HZ 12000000 |
Functions | |
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 FLASHCDW driver. More... | |
int | main (void) |
Main function running the example on both the flash array and the User page. More... | |
static void | print_nvram_variables (nvram_data_t *nvram_data) |
Prints the variables stored in NVRAM. More... | |
Variables | |
static nvram_data_t | flash_nvram_data |
NVRAM data structure located in the flash array. More... | |
static nvram_data_t | user_nvram_data |
NVRAM data structure located in the User page. More... | |
Parameters to pcl_configure_clocks(). | |
static scif_gclk_opt_t | gc_dfllif_ref_opt = { SCIF_GCCTRL_SLOWCLOCK, 0, false} |
static pcl_freq_param_t | pcl_dfll_freq_param |
#define EXAMPLE_TARGET_DFLL_FREQ_HZ 96000000 |
#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ 12000000 |
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ 12000000 |
Referenced by main().
|
static |
This is an example demonstrating flash read / write data accesses using the FLASHCDW driver.
caption | Caption to print before running the example. |
nvram_data | Pointer to the NVRAM data structure to use in the example. |
References flashcdw_memcpy(), flashcdw_memset, print_dbg(), 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 running the example on both the flash array and the User page.
References DBG_USART_CLOCK_MASK, EXAMPLE_TARGET_PBACLK_FREQ_HZ, flash_nvram_data, flash_rw_example(), FOSC0, init_dbg_rs232(), pcl_configure_clocks(), pcl_dfll_freq_param, pcl_disable_module, PCL_OSC0, pcl_switch_to_osc(), SLEEP, and user_nvram_data.
|
static |
Prints the variables stored in NVRAM.
nvram_data | Pointer to the NVRAM data structure to print. |
References print_dbg(), print_dbg_char_hex(), print_dbg_hex(), print_dbg_short_hex(), nvram_data_t::var16, nvram_data_t::var32, nvram_data_t::var8, and nvram_data_t::var8_3.
Referenced by flash_rw_example().
|
static |
NVRAM data structure located in the flash array.
Referenced by main().
|
static |
|
static |
Referenced by main().
|
static |
NVRAM data structure located in the User page.
Referenced by main().