Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for AT25DFx driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_clock.h>
#include <conf_board.h>
#include <conf_test.h>
#include <at25dfx.h>
#include <conf_at25dfx.h>

Macros

#define TEST_PROTECT_ADDRESS   0x200
 

Functions

int main (void)
 Run AT25DFx driver unit tests. More...
 
static void run_test_at25dfx_data_access (const struct test_case *test)
 Test data read, write and erase API functions. More...
 
static void run_test_at25dfx_init (const struct test_case *test)
 Test AT25DFx initialization procedure. More...
 
static void run_test_at25dfx_protect (const struct test_case *test)
 Test AT25DFx protect functions. More...
 

Variables

static uint8_t data_buff [AT25DFX_UNIT_TEST_PAGE_SIZE]
 

#define TEST_PROTECT_ADDRESS   0x200

static void run_test_at25dfx_data_access ( const struct test_case test)
static

Test data read, write and erase API functions.

This test calls the data chip erase, read, write and block erase API functions.

Parameters
testCurrent test case.

References AT25_ERROR, AT25_SUCCESS, AT25_TYPE_UNPROTECT, at25dfx_erase_block(), at25dfx_protect_chip(), at25dfx_read(), AT25DFX_UNIT_TEST_BLOCK_ADDR, AT25DFX_UNIT_TEST_BLOCK_SIZE, AT25DFX_UNIT_TEST_PAGE_SIZE, at25dfx_write(), data_buff, and test_assert_true.

Referenced by main().

static void run_test_at25dfx_init ( const struct test_case test)
static

Test AT25DFx initialization procedure.

This test calls the initialization function and checks the SerialFlash.

Parameters
testCurrent test case.

References AT25_SUCCESS, at25dfx_initialize(), at25dfx_mem_check(), AT25DFX_MEM_ID, at25dfx_set_mem_active(), and test_assert_true.

Referenced by main().

static void run_test_at25dfx_protect ( const struct test_case test)
static

uint8_t data_buff[AT25DFX_UNIT_TEST_PAGE_SIZE]
static