Unit tests for EMAC driver.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include "board.h"
#include <sysclk.h>
#include "emac.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 "rstc.h"
#include "ethernet_phy.h"
Macros | |
#define | EMAC_UINT_TEST_MAX_RETRY_TIME 50 |
Functions | |
void | EMAC_Handler (void) |
EMAC interrupt handler. More... | |
int | main (void) |
Run EMAC driver unit tests. More... | |
static void | run_emac_link_test (const struct test_case *test) |
EMAC link test function. More... | |
static void | run_emac_read_write_test (const struct test_case *test) |
Test EMAC read/write interfaces. More... | |
Variables | |
static uint8_t | gs_arp_frame [] |
static emac_device_t | gs_emac_dev |
The EMAC driver instance. More... | |
static uint8_t | gs_uc_eth_buffer [EMAC_FRAME_LENTGH_MAX] |
Buffer for ethernet packets. More... | |
static uint8_t | gs_uc_mac_address [] |
The MAC address used for the test. More... | |
#define EMAC_UINT_TEST_MAX_RETRY_TIME 50 |
Referenced by run_emac_read_write_test().
void EMAC_Handler | ( | void | ) |
EMAC interrupt handler.
References emac_handler().
int main | ( | void | ) |
Run EMAC driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_TEST_BAUDRATE, CONF_TEST_PARITY, CONF_TEST_USART, CONSOLE_UART_ID, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_emac_link_test(), run_emac_read_write_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
|
static |
EMAC link test function.
test | Current test case. |
References BOARD_EMAC_PHY_ADDR, emac_dev_init(), EMAC_OK, ethernet_phy_auto_negotiate(), ethernet_phy_init(), ethernet_phy_set_link(), gs_uc_mac_address, emac_device::p_hw, pmc_enable_periph_clk(), rstc_get_status(), rstc_reset_extern(), rstc_set_external_reset(), sysclk_get_cpu_hz(), test_assert_true, emac_options::uc_copy_all_frame, emac_options::uc_mac_addr, and emac_options::uc_no_boardcast.
Referenced by main().
|
static |
Test EMAC read/write interfaces.
test | Current test case. |
References emac_dev_read(), emac_dev_write(), EMAC_OK, EMAC_UINT_TEST_MAX_RETRY_TIME, gs_arp_frame, gs_uc_eth_buffer, gs_uc_mac_address, and test_assert_true.
Referenced by main().
|
static |
Referenced by run_emac_read_write_test().
|
static |
The EMAC driver instance.
|
static |
Buffer for ethernet packets.
Referenced by run_emac_read_write_test().
|
static |
The MAC address used for the test.
Referenced by run_emac_link_test(), and run_emac_read_write_test().