/*! ***************************************************************************** ** \file gd_lib/GK7101/inc/gd_ethernet.h ** ** \version 2.0 ** ** \date Sept 09, 2014 ** ** \author Steven Yu ** ** \brief Ethernet Driver. ** ** This application allows testing of the ethernet function. ** ** \attention THIS SAMPLE CODE IS PROVIDED AS IS. GOKE MICROELECTRONICS ** ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR ** OMMISSIONS. ** ** (C) Copyright 2002 - 2014 by Goke Microelectronics Shanghai WSC ** ******************************************************************************* */ //#define PRINT_ETH_LOG #ifndef _GD_ETHERNET_H_ #define _GD_ETHERNET_H_ #include "gtypes.h" #include #include "gd_gpio.h" //***************************************************************************** //***************************************************************************** //** Defines and Macros //***************************************************************************** //***************************************************************************** /* Length of Ethernet Mac address in bytes (Do NOT change) */ #define GD_ETH_MAC_ADDR_NUM (6) typedef U8 GD_ETH_MacT[GD_ETH_MAC_ADDR_NUM]; #define GD_ETH_IP_ADDR_NUM (4) typedef U8 GD_ETH_IpT[GD_ETH_IP_ADDR_NUM]; #define GD_ETH_ERR_BASE (GD_ETH_MODULE_ID << 16) //***************************************************************************** //***************************************************************************** //** Enumerated types //***************************************************************************** //***************************************************************************** enum { GD_ERR_ETH_NOT_SUPPORTED = GD_ETH_ERR_BASE, //!< Device not supported. GD_ERR_ETH_NOT_OPEN, GD_ERR_ETH_PHY_NOT_EXIST, GD_ERR_ETH_PHY_RW, GD_ERR_ETH_PHY_OTHER, GD_ERR_ETH_MAC_NOT_OK, GD_ERR_ETH_LINK_DOWN, GD_ERR_ETH_TB_OVER, GD_ERR_ETH_NO_TD, }; /*! ************************************************************************* ** \brief Version of Ethernet driver. ** ** This number consists of a \b major version number stored in bits ** 16 to 31 (upper word) and a \b minor version number stored in bits ** 0 to 15 (lower word). ** - The \b major number has to be increased when a parameter change ** occurs for the existing driver's API after its first release. ** - The \b minor number has to be increased when functions are added to ** the existing driver's API after its first release. ** ** \note This value has to be assigned to the \b version field of the ** GD_ETH_OpenParamsT structure. ************************************************************************* */ typedef enum { GD_ETH_VERSION = 0x00020000 //!< The current driver version }GD_ETH_VersionE; /*! ************************************************************************* ** \brief internal Or external PHY for Ethernet driver. ** ** Indicate speed setting. ** Used on GD_ETH_Open() and GD_ETH_GetStat() ************************************************************************* */ typedef enum { GD_ETH_PHY_INTERNAL = 0, //!