PER Firmware
Loading...
Searching...
No Matches
wizchip_conf.h File Reference

WIZCHIP Config Header File. More...

#include <stdint.h>
#include "w5500.h"

Go to the source code of this file.

Classes

struct  __WIZCHIP
 The set of callback functions for W5500:WIZCHIP I/O functions W5200:WIZCHIP_IO_Functions_W5200. More...
 
struct  __WIZCHIP::_CRIS
 
struct  __WIZCHIP::_CS
 
union  __WIZCHIP::_IF
 
struct  wiz_PhyConf_t
 
struct  wiz_NetInfo_t
 
struct  wiz_NetTimeout_t
 

Macros

#define W5100   5100
 Select WIZCHIP.
 
#define W5100S   5100 + 5
 
#define W5200   5200
 
#define W5300   5300
 
#define W5500   5500
 
#define _WIZCHIP_   W5500
 
#define _WIZCHIP_IO_MODE_NONE_   0x0000
 
#define _WIZCHIP_IO_MODE_BUS_   0x0100
 
#define _WIZCHIP_IO_MODE_SPI_   0x0200
 
#define _WIZCHIP_IO_MODE_BUS_DIR_   (_WIZCHIP_IO_MODE_BUS_ + 1)
 
#define _WIZCHIP_IO_MODE_BUS_INDIR_   (_WIZCHIP_IO_MODE_BUS_ + 2)
 
#define _WIZCHIP_IO_MODE_SPI_VDM_   (_WIZCHIP_IO_MODE_SPI_ + 1)
 
#define _WIZCHIP_IO_MODE_SPI_FDM_   (_WIZCHIP_IO_MODE_SPI_ + 2)
 
#define _WIZCHIP_IO_MODE_SPI_5500_   (_WIZCHIP_IO_MODE_SPI_ + 3)
 
#define _WIZCHIP_ID_   "W5500\0"
 
#define _WIZCHIP_IO_MODE_   _WIZCHIP_IO_MODE_SPI_VDM_
 Define interface mode.
.
 
#define _WIZCHIP_IO_BASE_   0x00000000
 Define I/O base address when BUS IF mode.
 
#define _WIZCHIP_SOCK_NUM_   8
 The count of independant socket of WIZCHIP.
 
#define PHY_CONFBY_HW   0
 Configured PHY operation mode by HW pin.
 
#define PHY_CONFBY_SW   1
 Configured PHY operation mode by SW register.
 
#define PHY_MODE_MANUAL   0
 Configured PHY operation mode with user setting.
 
#define PHY_MODE_AUTONEGO   1
 Configured PHY operation mode with auto-negotiation.
 
#define PHY_SPEED_10   0
 Link Speed 10.
 
#define PHY_SPEED_100   1
 Link Speed 100.
 
#define PHY_DUPLEX_HALF   0
 Link Half-Duplex.
 
#define PHY_DUPLEX_FULL   1
 Link Full-Duplex.
 
#define PHY_LINK_OFF   0
 Link Off.
 
#define PHY_LINK_ON   1
 Link On.
 
#define PHY_POWER_NORM   0
 PHY power normal mode.
 
#define PHY_POWER_DOWN   1
 PHY power down mode.
 

Typedefs

typedef uint8_t iodata_t
 
typedef struct __WIZCHIP _WIZCHIP
 The set of callback functions for W5500:WIZCHIP I/O functions W5200:WIZCHIP_IO_Functions_W5200.
 
typedef struct wiz_PhyConf_t wiz_PhyConf
 
typedef struct wiz_NetInfo_t wiz_NetInfo
 
typedef struct wiz_NetTimeout_t wiz_NetTimeout
 

Enumerations

enum  ctlwizchip_type {
  CW_RESET_WIZCHIP , CW_INIT_WIZCHIP , CW_GET_INTERRUPT , CW_CLR_INTERRUPT ,
  CW_SET_INTRMASK , CW_GET_INTRMASK , CW_SET_INTRTIME , CW_GET_INTRTIME ,
  CW_GET_ID , CW_RESET_PHY , CW_SET_PHYCONF , CW_GET_PHYCONF ,
  CW_GET_PHYSTATUS , CW_SET_PHYPOWMODE , CW_GET_PHYPOWMODE , CW_GET_PHYLINK
}
 
enum  ctlnetwork_type {
  CN_SET_NETINFO , CN_GET_NETINFO , CN_SET_NETMODE , CN_GET_NETMODE ,
  CN_SET_TIMEOUT , CN_GET_TIMEOUT
}
 
enum  intr_kind {
  IK_WOL = (1 << 4) , IK_PPPOE_TERMINATED = (1 << 5) , IK_DEST_UNREACH = (1 << 6) , IK_IP_CONFLICT = (1 << 7) ,
  IK_SOCK_0 = (1 << 8) , IK_SOCK_1 = (1 << 9) , IK_SOCK_2 = (1 << 10) , IK_SOCK_3 = (1 << 11) ,
  IK_SOCK_4 = (1 << 12) , IK_SOCK_5 = (1 << 13) , IK_SOCK_6 = (1 << 14) , IK_SOCK_7 = (1 << 15) ,
  IK_SOCK_ALL = (0xFF << 8)
}
 
enum  dhcp_mode { NETINFO_STATIC = 1 , NETINFO_DHCP }
 
enum  netmode_type { NM_FORCEARP = (1 << 1) , NM_WAKEONLAN = (1 << 5) , NM_PINGBLOCK = (1 << 4) , NM_PPPOE = (1 << 3) }
 

Functions

void reg_wizchip_cris_cbfunc (void(*cris_en)(void), void(*cris_ex)(void))
 Registers call back function for critical section of I/O functions such as WIZCHIP_READ, WIZCHIP_WRITE, WIZCHIP_READ_BUF and WIZCHIP_WRITE_BUF.
 
void reg_wizchip_cs_cbfunc (void(*cs_sel)(void), void(*cs_desel)(void))
 Registers call back function for WIZCHIP select & deselect.
 
void reg_wizchip_bus_cbfunc (iodata_t(*bus_rb)(uint32_t addr), void(*bus_wb)(uint32_t addr, iodata_t wb))
 Registers call back function for bus interface.
 
void reg_wizchip_spi_cbfunc (uint8_t(*spi_rb)(uint32_t addr), void(*spi_wb)(uint32_t addr, uint8_t wb))
 Registers call back function for SPI interface.
 
void reg_wizchip_spiburst_cbfunc (void(*spi_rb)(uint32_t addr, uint8_t *pBuf, uint16_t len), void(*spi_wb)(uint32_t addr, uint8_t *pBuf, uint16_t len))
 Registers call back function for SPI interface.
 
int8_t ctlwizchip (ctlwizchip_type cwtype, void *arg)
 Controls to the WIZCHIP.
 
int8_t ctlnetwork (ctlnetwork_type cntype, void *arg)
 Controls to network.
 
void wizchip_sw_reset (void)
 Reset WIZCHIP by softly.
 
int8_t wizchip_init (uint8_t *txsize, uint8_t *rxsize)
 Initializes WIZCHIP with socket buffer size.
 
void wizchip_clrinterrupt (intr_kind intr)
 Clear Interrupt of WIZCHIP.
 
intr_kind wizchip_getinterrupt (void)
 Get Interrupt of WIZCHIP.
 
void wizchip_setinterruptmask (intr_kind intr)
 Mask or Unmask Interrupt of WIZCHIP.
 
intr_kind wizchip_getinterruptmask (void)
 Get Interrupt mask of WIZCHIP.
 
int8_t wizphy_getphylink (void)
 get the link status of phy in WIZCHIP. No use in W5100
 
int8_t wizphy_getphypmode (void)
 get the power mode of PHY in WIZCHIP. No use in W5100
 
void wizphy_reset (void)
 Reset phy. Vailid only in W5500.
 
void wizphy_setphyconf (wiz_PhyConf *phyconf)
 Set the phy information for WIZCHIP without power mode.
 
void wizphy_getphyconf (wiz_PhyConf *phyconf)
 Get phy configuration information.
 
void wizphy_getphystat (wiz_PhyConf *phyconf)
 Get phy status.
 
int8_t wizphy_setphypmode (uint8_t pmode)
 set the power mode of phy inside WIZCHIP. Refer to PHYCFGR in W5500, PHYSTATUS in W5200
 
void wizchip_setnetinfo (wiz_NetInfo *pnetinfo)
 Set the network information for WIZCHIP.
 
void wizchip_getnetinfo (wiz_NetInfo *pnetinfo)
 Get the network information for WIZCHIP.
 
int8_t wizchip_setnetmode (netmode_type netmode)
 Set the network mode such WOL, PPPoE, Ping Block, and etc.
 
netmode_type wizchip_getnetmode (void)
 Get the network mode such WOL, PPPoE, Ping Block, and etc.
 
void wizchip_settimeout (wiz_NetTimeout *nettime)
 Set retry time value(_RTR_) and retry count(_RCR_).
 
void wizchip_gettimeout (wiz_NetTimeout *nettime)
 Get retry time value(_RTR_) and retry count(_RCR_).
 

Variables

_WIZCHIP WIZCHIP
 

Detailed Description

WIZCHIP Config Header File.

Version
1.0.0
Date
2013/10/21
Revision history
<2015/02/05> Notice The version history is not updated after this point. Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. >> https://github.com/Wiznet/ioLibrary_Driver <2013/10/21> 1st Release
Author
MidnightCow

Copyright (c) 2013, WIZnet Co., LTD. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright

notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ _WIZCHIP_IO_BASE_

#define _WIZCHIP_IO_BASE_   0x00000000

Define I/O base address when BUS IF mode.

Todo
Should re-define it to fit your system when BUS IF Mode (_WIZCHIP_IO_MODE_BUS_, _WIZCHIP_IO_MODE_BUS_DIR_, _WIZCHIP_IO_MODE_BUS_INDIR_).

ex> #define _WIZCHIP_IO_BASE_ 0x00008000

◆ _WIZCHIP_IO_MODE_

#define _WIZCHIP_IO_MODE_   _WIZCHIP_IO_MODE_SPI_VDM_

Define interface mode.
.

Todo
Should select interface mode as chip.

◆ _WIZCHIP_IO_MODE_BUS_

#define _WIZCHIP_IO_MODE_BUS_   0x0100

Bus interface mode

◆ _WIZCHIP_IO_MODE_BUS_DIR_

#define _WIZCHIP_IO_MODE_BUS_DIR_   (_WIZCHIP_IO_MODE_BUS_ + 1)

BUS interface mode for direct

◆ _WIZCHIP_IO_MODE_BUS_INDIR_

#define _WIZCHIP_IO_MODE_BUS_INDIR_   (_WIZCHIP_IO_MODE_BUS_ + 2)

BUS interface mode for indirect

◆ _WIZCHIP_IO_MODE_SPI_

#define _WIZCHIP_IO_MODE_SPI_   0x0200

SPI interface mode

◆ _WIZCHIP_IO_MODE_SPI_5500_

#define _WIZCHIP_IO_MODE_SPI_5500_   (_WIZCHIP_IO_MODE_SPI_ + 3)

SPI interface mode for fixed length data mode

◆ _WIZCHIP_IO_MODE_SPI_FDM_

#define _WIZCHIP_IO_MODE_SPI_FDM_   (_WIZCHIP_IO_MODE_SPI_ + 2)

SPI interface mode for fixed length data mode

◆ _WIZCHIP_IO_MODE_SPI_VDM_

#define _WIZCHIP_IO_MODE_SPI_VDM_   (_WIZCHIP_IO_MODE_SPI_ + 1)

SPI interface mode for variable length data

◆ W5100

#define W5100   5100

Select WIZCHIP.

Todo
You should select one, W5100, W5100S, W5200, W5300, W5500 or etc.

ex> #define _WIZCHIP_ W5500

Function Documentation

◆ reg_wizchip_bus_cbfunc()

void reg_wizchip_bus_cbfunc ( iodata_t(* bus_rb )(uint32_t addr),
void(* bus_wb )(uint32_t addr, iodata_t wb) )

Registers call back function for bus interface.

Parameters
bus_rb: callback function to read byte data using system bus
bus_wb: callback function to write byte data using system bus
Todo
Describe wizchip_bus_readbyte and wizchip_bus_writebyte function or register your functions.
Note
If you do not describe or register, null function is called.

◆ reg_wizchip_cris_cbfunc()

void reg_wizchip_cris_cbfunc ( void(* cris_en )(void),
void(* cris_ex )(void) )

Registers call back function for critical section of I/O functions such as WIZCHIP_READ, WIZCHIP_WRITE, WIZCHIP_READ_BUF and WIZCHIP_WRITE_BUF.

Parameters
cris_en: callback function for critical section enter.
cris_ex: callback function for critical section exit.
Todo
Describe WIZCHIP_CRITICAL_ENTER and WIZCHIP_CRITICAL_EXIT marco or register your functions.
Note
If you do not describe or register, default functions(wizchip_cris_enter & wizchip_cris_exit) is called.

◆ reg_wizchip_cs_cbfunc()

void reg_wizchip_cs_cbfunc ( void(* cs_sel )(void),
void(* cs_desel )(void) )

Registers call back function for WIZCHIP select & deselect.

Parameters
cs_sel: callback function for WIZCHIP select
cs_desel: callback fucntion for WIZCHIP deselect
Todo
Describe wizchip_cs_select and wizchip_cs_deselect function or register your functions.
Note
If you do not describe or register, null function is called.

◆ reg_wizchip_spi_cbfunc()

void reg_wizchip_spi_cbfunc ( uint8_t(* spi_rb )(uint32_t addr),
void(* spi_wb )(uint32_t addr, uint8_t wb) )

Registers call back function for SPI interface.

Parameters
spi_rb: callback function to read byte using SPI
spi_wb: callback function to write byte using SPI
Todo
Describe wizchip_spi_readbyte and wizchip_spi_writebyte function or register your functions.
Note
If you do not describe or register, null function is called.

◆ reg_wizchip_spiburst_cbfunc()

void reg_wizchip_spiburst_cbfunc ( void(* spi_rb )(uint32_t addr, uint8_t *pBuf, uint16_t len),
void(* spi_wb )(uint32_t addr, uint8_t *pBuf, uint16_t len) )

Registers call back function for SPI interface.

Parameters
spi_rb: callback function to burst read using SPI
spi_wb: callback function to burst write using SPI
Todo
Describe wizchip_spi_readbyte and wizchip_spi_writebyte function or register your functions.
Note
If you do not describe or register, null function is called.

Variable Documentation

◆ WIZCHIP

_WIZCHIP WIZCHIP
extern

\ref _WIZCHIP instance