📄 w5300.h
字号:
#define Sn_MR_TCP 0x01 /**< Protocol bits of Sn_MR. */
#define Sn_MR_UDP 0x02 /**< Protocol bits of Sn_MR. */
#define Sn_MR_IPRAW 0x03 /**< Protocol bits of Sn_MR. */
#define Sn_MR_MACRAW 0x04 /**< Protocol bits of Sn_MR. */
#define Sn_MR_PPPoE 0x05 /**< Protocol bits of Sn_MR. */
/******************************/
/* The values of CR defintion */
/******************************/
#define Sn_CR_OPEN 0x01 /**< OPEN command value of Sn_CR. */
#define Sn_CR_LISTEN 0x02 /**< LISTEN command value of Sn_CR. */
#define Sn_CR_CONNECT 0x04 /**< CONNECT command value of Sn_CR. */
#define Sn_CR_DISCON 0x08 /**< DISCONNECT command value of Sn_CR. */
#define Sn_CR_CLOSE 0x10 /**< CLOSE command value of Sn_CR. */
#define Sn_CR_SEND 0x20 /**< SEND command value of Sn_CR. */
#define Sn_CR_SEND_MAC 0x21 /**< SEND_MAC command value of Sn_CR. */
#define Sn_CR_SEND_KEEP 0x22 /**< SEND_KEEP command value of Sn_CR */
#define Sn_CR_RECV 0x40 /**< RECV command value of Sn_CR */
#define Sn_CR_PCON 0x23 /**< PCON command value of Sn_CR */
#define Sn_CR_PDISCON 0x24 /**< PDISCON command value of Sn_CR */
#define Sn_CR_PCR 0x25 /**< PCR command value of Sn_CR */
#define Sn_CR_PCN 0x26 /**< PCN command value of Sn_CR */
#define Sn_CR_PCJ 0x27 /**< PCJ command value of Sn_CR */
/*********************************/
/* The values of Sn_IR defintion */
/*********************************/
#define Sn_IR_PRECV 0x80 /**< PPP receive bit of Sn_IR */
#define Sn_IR_PFAIL 0x40 /**< PPP fail bit of Sn_IR */
#define Sn_IR_PNEXT 0x20 /**< PPP next phase bit of Sn_IR */
#define Sn_IR_SENDOK 0x10 /**< Send OK bit of Sn_IR */
#define Sn_IR_TIMEOUT 0x08 /**< Timout bit of Sn_IR */
#define Sn_IR_RECV 0x04 /**< Receive bit of Sn_IR */
#define Sn_IR_DISCON 0x02 /**< Disconnect bit of Sn_IR */
#define Sn_IR_CON 0x01 /**< Connect bit of Sn_IR */
/**********************************/
/* The values of Sn_SSR defintion */
/**********************************/
#define SOCK_CLOSED 0x00 /**< SOCKETn is released */
#define SOCK_ARP 0x01 /**< ARP-request is transmitted in order to acquire destination hardware address. */
#define SOCK_INIT 0x13 /**< SOCKETn is open as TCP mode. */
#define SOCK_LISTEN 0x14 /**< SOCKETn operates as "TCP SERVER" and waits for connection-request (SYN packet) from "TCP CLIENT". */
#define SOCK_SYNSENT 0x15 /**< Connect-request(SYN packet) is transmitted to "TCP SERVER". */
#define SOCK_SYNRECV 0x16 /**< Connect-request(SYN packet) is received from "TCP CLIENT". */
#define SOCK_ESTABLISHED 0x17 /**< TCP connection is established. */
#define SOCK_FIN_WAIT 0x18 /**< SOCKETn is closing. */
#define SOCK_CLOSING 0x1A /**< SOCKETn is closing. */
#define SOCK_TIME_WAIT 0x1B /**< SOCKETn is closing. */
#define SOCK_CLOSE_WAIT 0x1C /**< Disconnect-request(FIN packet) is received from the peer. */
#define SOCK_LAST_ACK 0x1D /**< SOCKETn is closing. */
#define SOCK_UDP 0x22 /**< SOCKETn is open as UDP mode. */
#define SOCK_IPRAW 0x32 /**< SOCKETn is open as IPRAW mode. */
#define SOCK_MACRAW 0x42 /**< SOCKET0 is open as MACRAW mode. */
#define SOCK_PPPoE 0x5F /**< SOCKET0 is open as PPPoE mode. */
/* IP PROTOCOL */
#define IPPROTO_IP 0 /* Dummy for IP */
#define IPPROTO_ICMP 1 /* Control message protocol */
#define IPPROTO_IGMP 2 /* Internet group management protocol */
#define IPPROTO_GGP 3 /* Gateway^2 (deprecated) */
#define IPPROTO_TCP 6 /* TCP */
#define IPPROTO_PUP 12 /* PUP */
#define IPPROTO_UDP 17 /* UDP */
#define IPPROTO_IDP 22 /* XNS idp */
#define IPPROTO_ND 77 /* UNOFFICIAL net disk protocol */
#define IPPROTO_RAW 255 /* Raw IP packet */
/***********************
* Basic I/O Function *
***********************/
/**
* It reads a value from a register
*/
uint16 IINCHIP_READ(uint32 addr);
/**
* It writes a value to a register
*/
void IINCHIP_WRITE(uint32 addr,uint16 data);
/**
* It gets MR value.
*/
uint16 getMR(void);
/**
* It sets MR value
*/
void setMR(uint16 val);
/***********************************
* COMMON Register Access Function *
***********************************/
/**
* It gets IR value
*/
uint16 getIR(void);
/**
* It sets IR value
*/
void setIR(uint16 val);
/**
* It gets IMR value
*/
uint16 getIMR(void);
/**
* It sets IMR value
*/
void setIMR(uint16 mask);
/**
* It gets the source hardware address
*/
void getSHAR(uint8 * addr);
/**
* It sets the source hardware address
*/
void setSHAR(uint8 * addr);
/**
* It gets the gateway IP address
*/
void getGAR(uint8 * addr);
/**
* It sets the gateway IP address
*/
void setGAR(uint8 * addr); // set gateway address
/**
* It gets the subnet mask address
*/
void getSUBR(uint8 * addr);
/**
* It sets the subnet mask address
*/
void setSUBR(uint8 * addr); // set subnet mask address
/**
* It gets the source IP address
*/
void getSIPR(uint8 * addr);
/**
* It sets the source IP address
*/
void setSIPR(uint8 * addr); // set local IP address
/**
* It gets RTR value
*/
uint16 getRTR(void);
/**
* It sets RTR value
*/
void setRTR(uint16 timeout); // set retry duration for data transmission, connection, closing ...
/**
* It gets RCR value
*/
uint8 getRCR(void);
/**
* It sets RCR value
*/
void setRCR(uint8 retry);
/**
* It gets PATR value
*/
uint16 getPATR(void);
/**
* It gets PTIMER value
*/
uint8 getPTIMER(void);
/**
* It sets PTIMER value
*/
void setPTIMER(uint8 time);
/**
* It gets PMAGICR value
*/
uint8 getPMAGICR(void);
/**
* It sets PTIMER value
*/
void setPMAGICR(uint8 magic);
/**
* It gets PSIDR value
*/
uint16 getPSIDR(void);
/**
* It gets the PPPoE server hardware address
*/
void getPDHAR(uint8* addr);
/**
* It gets the unreachable destination IP address of ICMP message.
*/
void getUIPR(uint8* addr);
/**
* It gets the unreachable destination port number of ICMP message.
*/
uint16 getUPORTR(void);
/**
* It gets the fragmented MTU value of ICMP message.
*/
uint16 getFMTUR(void);
/**
* It gets Pn_BRDYR value.
*/
uint8 getPn_BRDYR(uint8 p);
/**
* It sets Pn_BRDYR value.
*/
void setPn_BRDYR(uint8 p, uint8 cfg);
/**
* It gets the buffer depth of PIN "BRDYn".
*/
uint16 getPn_BDPTHR(uint8 p);
/**
* It sets the buffer depth of PIN "BRDYn".
*/
void setPn_BDPTHR(uint8 p, uint16 depth);
/**
* It gets the ID of W5300.
*/
uint16 getIDR(void);
/***********************************
* SOCKET Register Access Function *
***********************************/
/**
* It gets Sn_MR value.
*/
uint16 getSn_MR(SOCKET s);
/**
* It sets Sn_MR value.
*/
void setSn_MR(SOCKET s, uint16 mode);
/**
* It gets Sn_CR value.
*/
uint8 getSn_CR(SOCKET s);
/**
* It sets Sn_CR value.
*/
void setSn_CR(SOCKET s, uint16 com);
/**
* It gets Sn_IMR value.
*/
uint8 getSn_IMR(SOCKET s);
/**
* It sets Sn_IMR value.
*/
void setSn_IMR(SOCKET s, uint8 mask);
/**
* It gets Sn_IR value.
*/
uint8 getSn_IR(SOCKET s);
/**
* It sets Sn_IR value.
*/
void setSn_IR(SOCKET s, uint8 ir);
/**
* It gets Sn_SSR value.
*/
uint8 getSn_SSR(SOCKET s);
/**
* It gets Sn_DHAR value.
*/
void getSn_DHAR(SOCKET s, uint8* addr);
/**
* It sets Sn_DHAR value.
*/
void setSn_DHAR(SOCKET s, uint8* addr);
// M_15052008 : Delete this function.
/*
* It gets Sn_DPORTR value.
*/
//uint16 getSn_DPORTR(SOCKET s);
/**
* It sets Sn_DPORTR value.
*/
void setSn_DPORTR(SOCKET s, uint16 port);
/**
* It gets Sn_DIPR value.
*/
void getSn_DIPR(SOCKET s, uint8* addr);
/**
* It sets Sn_DIPR value.
*/
void setSn_DIPR(SOCKET s, uint8* addr);
/**
* It gets Sn_MSSR value.
*/
uint16 getSn_MSSR(SOCKET s);
/**
* It sets Sn_MSSR value.
*/
void setSn_MSSR(SOCKET s, uint16 mss);
/**
* It gets Sn_KPALVTR value.
*/
uint8 getSn_KPALVTR(SOCKET s);
/**
* It sets Sn_KPALVTR value.
*/
void setSn_KPALVTR(SOCKET s, uint8 time);
/**
* It gets Sn_TX_WRSR value.
*/
uint32 getSn_TX_WRSR(SOCKET s);
/**
* It gets Sn_KPALVTR value.
*/
void setSn_TX_WRSR(SOCKET s, uint32 size);
/**
* It gets Sn_TX_FSR value.
*/
uint32 getSn_TX_FSR(SOCKET s);
/**
* It gets Sn_RX_RSR value.
*/
uint32 getSn_RX_RSR(SOCKET s);
/**
* It sets Sn_TX_FIFOR value.
*/
void setSn_TX_FIFOR(SOCKET s, uint16 data);
/**
* It gets Sn_RX_FIFOR value.
*/
uint16 getSn_RX_FIFOR(SOCKET s);
/**
* It gets Sn_PROTOR value.
*/
uint8 getSn_PROTOR(SOCKET s);
/**
* It sets Sn_PROTOR value.
*/
void setSn_PROTOR(SOCKET s, uint8 pronum);
/**
* It gets Sn_TOSR value.
*/
uint8 getSn_TOSR(SOCKET s);
/**
* It sets Sn_TOSR value.
*/
void setSn_TOSR(SOCKET s, uint8 tos);
/**
* It gets Sn_TTLR value.
*/
uint8 getSn_TTLR(SOCKET s);
/**
* It sets Sn_TTLR value.
*/
void setSn_TTLR(SOCKET s, uint8 ttl);
/**
* It gets Sn_FRAGR value.
*/
uint8 getSn_FRAGR(SOCKET s);
/**
* It sets Sn_FRAGR value.
*/
void setSn_FRAGR(SOCKET s, uint8 frag);
/*******
* ETC *
*******/
/* Initialization & Interrupt request routine */
/**
* It initializes W5300.
*/
void iinchip_init(void);
/**
* It handles the interrupt of W5300.
*/
#ifdef __DEF_IINCHIP_INT__
void iinchip_irq(void);
#endif
/* Interanl memory operation */
/**
* It allocate internal TX/RX meory of each SOCKET.
*/
uint8 sysinit(uint8* tx_size, uint8* rx_size); // setting tx/rx buf size
/**
* It copies data to interna TX memory
*/
uint32 wiz_write_buf(SOCKET s,uint8* buf,uint32 len);
/**
* It copies data to your buffer from interna RX memory
*/
uint32 wiz_read_buf(SOCKET s, uint8* buf,uint32 len);
/**
* It gets the max size of internal TX memory of each SOCKET
*/
uint32 getIINCHIP_TxMAX(SOCKET s);
/**
* It gets the max size of internal RX memory of each SOCKET
*/
uint32 getIINCHIP_RxMAX(SOCKET s);
#ifdef __DEF_IINCHIP_PPP__
/**
* It initializes to PPPoE of W5300
*/
uint8 pppinit(uint8 *id, uint8 idlen, uint8 *passwd, uint8 passwdlen);
/**
* It terminates PPPoE connection
*/
void pppterm(uint8 *mac, uint16 sessionid);
#endif
/**
* Delay function
*/
void wait_1us(uint32 us);
/**
* Delay function
*/
void wait_1ms(uint32 ms);
/**
* Delay function
*/
void wait_10ms(uint32 ms);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -