Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for GMAC driver.

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

#include <asf.h>
#include "board.h"
#include <sysclk.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include "conf_test.h"
#include "conf_board.h"
#include "mini_ip.h"
#include "conf_eth.h"

Macros

#define GMAC_UINT_TEST_MAX_RETRY_TIME   50
 

Functions

void GMAC_Handler (void)
 GMAC interrupt handler. More...
 
int main (void)
 Run GMAC driver unit tests. More...
 
static void run_gmac_link_test (const struct test_case *test)
 GMAC link test function. More...
 
static void run_gmac_read_write_test (const struct test_case *test)
 Test GMAC read/write interfaces. More...
 

Variables

static uint8_t gs_arp_frame []
 
static gmac_device_t gs_gmac_dev
 The GMAC driver instance. More...
 
static uint8_t gs_uc_eth_buffer [GMAC_FRAME_LENTGH_MAX]
 Buffer for ethernet packets. More...
 
static uint8_t gs_uc_mac_address []
 The MAC address used for the test. More...
 

#define GMAC_UINT_TEST_MAX_RETRY_TIME   50

void GMAC_Handler ( void  )

GMAC interrupt handler.

References gmac_handler(), and GMAC_QUE_0.

static void run_gmac_read_write_test ( const struct test_case test)
static

Test GMAC read/write interfaces.

Parameters
testCurrent test case.

References gmac_dev_read(), gmac_dev_write(), GMAC_OK, GMAC_QUE_0, GMAC_UINT_TEST_MAX_RETRY_TIME, gs_arp_frame, gs_uc_eth_buffer, gs_uc_mac_address, and test_assert_true.

Referenced by main().

uint8_t gs_arp_frame[]
static
Initial value:
= {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
ETHERNET_CONF_ETHADDR5, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01,
ETHERNET_CONF_IPADDR3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
#define ETHERNET_CONF_IPADDR0
WAN Address: 192.168.0.2.
Definition: conf_eth.h:61
#define ETHERNET_CONF_IPADDR2
Definition: conf_eth.h:63
#define ETHERNET_CONF_ETHADDR2
Definition: conf_eth.h:54
#define ETHERNET_CONF_IPADDR3
Definition: conf_eth.h:64
#define ETHERNET_CONF_GATEWAY_ADDR1
Definition: conf_eth.h:69
#define ETHERNET_CONF_ETHADDR0
MAC address definition.
Definition: conf_eth.h:52
#define ETHERNET_CONF_ETHADDR4
Definition: conf_eth.h:56
#define ETHERNET_CONF_ETHADDR5
Definition: conf_eth.h:57
#define ETHERNET_CONF_ETHADDR1
Definition: conf_eth.h:53
#define ETHERNET_CONF_GATEWAY_ADDR3
Definition: conf_eth.h:71
#define ETHERNET_CONF_GATEWAY_ADDR0
WAN gateway: 192.168.0.250.
Definition: conf_eth.h:68
#define ETHERNET_CONF_ETHADDR3
Definition: conf_eth.h:55
#define ETHERNET_CONF_IPADDR1
Definition: conf_eth.h:62
#define ETHERNET_CONF_GATEWAY_ADDR2
Definition: conf_eth.h:70

Referenced by run_gmac_read_write_test().

gmac_device_t gs_gmac_dev
static

The GMAC driver instance.

uint8_t gs_uc_eth_buffer[GMAC_FRAME_LENTGH_MAX]
static

Buffer for ethernet packets.

Referenced by run_gmac_read_write_test().

uint8_t gs_uc_mac_address[]
static
Initial value:
=
}
#define ETHERNET_CONF_ETHADDR2
Definition: conf_eth.h:54
#define ETHERNET_CONF_ETHADDR0
MAC address definition.
Definition: conf_eth.h:52
#define ETHERNET_CONF_ETHADDR4
Definition: conf_eth.h:56
#define ETHERNET_CONF_ETHADDR5
Definition: conf_eth.h:57
#define ETHERNET_CONF_ETHADDR1
Definition: conf_eth.h:53
#define ETHERNET_CONF_ETHADDR3
Definition: conf_eth.h:55

The MAC address used for the test.

Referenced by run_gmac_link_test(), and run_gmac_read_write_test().