#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 |
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... | |
#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_PBACLK_FREQ_HZ FOSC0 |
Referenced by at45dbx_resources_init(), and main().
#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().
#define TEST_FAIL "\t[FAIL]\r\n" |
#define TEST_SUCCESS "\t[PASS]\r\n" |
|
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 |
Tests single-byte access functions.
References at45dbx_read_byte(), at45dbx_read_close(), at45dbx_read_open(), at45dbx_write_byte(), at45dbx_write_close(), at45dbx_write_open(), print_dbg(), TEST_FAIL, and TEST_SUCCESS.
Referenced by main().
|
static |
Tests multiple-sector access functions.
References at45dbx_example_error_cnt, at45dbx_read_close(), at45dbx_read_multiple_sector(), at45dbx_read_open(), at45dbx_write_close(), at45dbx_write_multiple_sector(), at45dbx_write_open(), print_dbg(), print_dbg_ulong(), TEST_FAIL, and TEST_SUCCESS.
Referenced by main().
|
static |
Tests single-sector access functions.
References at45dbx_read_close(), at45dbx_read_open(), at45dbx_read_sector_2_ram(), AT45DBX_SECTOR_SIZE, at45dbx_write_close(), at45dbx_write_open(), at45dbx_write_sector_from_ram(), print_dbg(), TEST_FAIL, and TEST_SUCCESS.
Referenced by main().
|
static |
Initializes AT45DBX resources: GPIO, SPI and AT45DBX.
References AT45DBX_ENABLE_NPCS_PIN, at45dbx_init(), AT45DBX_MEM_CNT, AT45DBX_SPI, AT45DBX_SPI_BITS, AT45DBX_SPI_FIRST_NPCS, AT45DBX_SPI_MASTER_SPEED, AT45DBX_SPI_MISO_FUNCTION, AT45DBX_SPI_MISO_PIN, AT45DBX_SPI_MOSI_FUNCTION, AT45DBX_SPI_MOSI_PIN, AT45DBX_SPI_SCK_FUNCTION, AT45DBX_SPI_SCK_PIN, EXAMPLE_TARGET_PBACLK_FREQ_HZ, gpio_enable_module(), MREPEAT(), spi_options_t::reg, spi_enable(), spi_initMaster(), and spi_selectionMode().
Referenced by main().
int main | ( | void | ) |
Main function. Execution starts here.
References at45dbx_example_check_mem(), at45dbx_example_test_byte_mem(), at45dbx_example_test_multiple_sector(), at45dbx_example_test_RAM_mem(), at45dbx_resources_init(), EXAMPLE_TARGET_PBACLK_FREQ_HZ, FOSC0, init_dbg_rs232(), MSG_GOODBYE, MSG_WELCOME, OSC0_STARTUP, pcl_configure_clocks(), PCL_OSC0, pcl_switch_to_osc(), and print_dbg().
|
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().
|
static |
Pattern to test the AT45DBX multiple-sector access functions with.