Microchip® Advanced Software Framework

_asf_v1/example/at45dbx_example.c File Reference
#include <string.h>
#include "compiler.h"
#include "preprocessor.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "spi.h"
#include "print_funcs.h"
#include "conf_at45dbx.h"
#include "at45dbx.h"

Macros

#define AT45DBX_ENABLE_NPCS_PIN(NPCS, unused)   {AT45DBX_SPI_NPCS##NPCS##_PIN, AT45DBX_SPI_NPCS##NPCS##_FUNCTION},
 
#define MSG_GOODBYE   "\r\n ---------- End of AT45DBX example ---------- \r\n"
 
#define MSG_WELCOME   "\r\n ---------- Welcome to AT45DBX example ---------- \r\n"
 Welcome message to display. More...
 
Test Result Messages
#define TEST_SUCCESS   "\t[PASS]\r\n"
 
#define TEST_FAIL   "\t[FAIL]\r\n"
 
Clock Settings
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ   FOSC0
 
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ   12000000
 
#define EXAMPLE_TARGET_DFLL_FREQ_HZ   96000000
 
#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ   12000000
 

Functions

static void at45dbx_example_check_mem (void)
 Performs a memory check on all DFs. More...
 
static void at45dbx_example_test_byte_mem (void)
 Tests single-byte access functions. More...
 
static void at45dbx_example_test_multiple_sector (void)
 Tests multiple-sector access functions. More...
 
static void at45dbx_example_test_RAM_mem (void)
 Tests single-sector access functions. More...
 
void at45dbx_read_multiple_sector_callback (const void *psector)
 Callback function invoked after each sector read during at45dbx_read_multiple_sector. More...
 
static void at45dbx_resources_init (void)
 Initializes AT45DBX resources: GPIO, SPI and AT45DBX. More...
 
void at45dbx_write_multiple_sector_callback (void *psector)
 Callback function invoked before each sector write during at45dbx_write_multiple_sector. More...
 
int main (void)
 Main function. Execution starts here. More...
 

Variables

static U32 at45dbx_example_error_cnt
 Number of erroneous bytes detected during the test of the AT45DBX multiple- sector access functions. More...
 
static const Union32 PATTERN_MULTIPLE_SECTOR = {0xDEADBEEF}
 Pattern to test the AT45DBX multiple-sector access functions with. 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 AT45DBX_ENABLE_NPCS_PIN (   NPCS,
  unused 
)    {AT45DBX_SPI_NPCS##NPCS##_PIN, AT45DBX_SPI_NPCS##NPCS##_FUNCTION},

Referenced by at45dbx_resources_init().

#define EXAMPLE_TARGET_DFLL_FREQ_HZ   96000000

Referenced by main().

#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ   12000000

Referenced by main().

#define EXAMPLE_TARGET_PBACLK_FREQ_HZ   FOSC0
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ   12000000
#define MSG_GOODBYE   "\r\n ---------- End of AT45DBX example ---------- \r\n"

Referenced by main().

#define MSG_WELCOME   "\r\n ---------- Welcome to AT45DBX example ---------- \r\n"

Welcome message to display.

Referenced by main(), and ushell_task().

static void at45dbx_example_check_mem ( void  )
static

Performs a memory check on all DFs.

References at45dbx_mem_check(), AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, print_dbg(), print_dbg_ulong(), TEST_FAIL, and TEST_SUCCESS.

Referenced by main().

static void at45dbx_example_test_byte_mem ( void  )
static
static void at45dbx_example_test_multiple_sector ( void  )
static
static void at45dbx_example_test_RAM_mem ( void  )
static
static void at45dbx_resources_init ( void  )
static

U32 at45dbx_example_error_cnt
static

Number of erroneous bytes detected during the test of the AT45DBX multiple- sector access functions.

Referenced by at45dbx_example_test_multiple_sector(), and at45dbx_read_multiple_sector_callback().

scif_gclk_opt_t gc_dfllif_ref_opt = { SCIF_GCCTRL_SLOWCLOCK, 0, false}
static

Referenced by clockfrequencies_configure(), and main().

const Union32 PATTERN_MULTIPLE_SECTOR = {0xDEADBEEF}
static

Pattern to test the AT45DBX multiple-sector access functions with.

pcl_freq_param_t pcl_dfll_freq_param
static
Initial value:
=
{
.main_clk_src = PCL_MC_DFLL0,
.pextra_params = &gc_dfllif_ref_opt
}
Definition: power_clocks_lib.h:106
#define EXAMPLE_TARGET_DFLL_FREQ_HZ
Definition: _asf_v1/example/at45dbx_example.c:138
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ
Definition: interrupt_usart_example.c:136
static scif_gclk_opt_t gc_dfllif_ref_opt
Definition: _asf_v1/example/at45dbx_example.c:398
#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ
Definition: _asf_v1/example/at45dbx_example.c:139

Referenced by clockfrequencies_configure(), and main().