API  2.3.0
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Functions

void wizInit ()
 Wiznet Init. More...
 
void wizSWReset ()
 Wiznet Software reset. More...
 
void wizMemInit (uint8 *tx_size, uint8 *rx_size)
 Sets Tx/Rx buffer size. More...
 
void SetNetInfo (wiz_NetInfo *netinfo)
 Sets the network information. More...
 
void GetNetInfo (wiz_NetInfo *netinfo)
 Gets the network information. More...
 
void SetSocketOption (uint8 option_type, uint16 option_value)
 Sets the network option. More...
 
int8 GetTCPSocketStatus (SOCKET s)
 Gets the TCP socket status. More...
 
int8 GetUDPSocketStatus (SOCKET s)
 Gets the UDP socket status. More...
 
int8 TCPServerOpen (SOCKET s, uint16 port)
 TCP Server open. More...
 
int8 TCPClientOpen (SOCKET s, uint16 port, uint8 *destip, uint16 destport)
 TCP Client Open. More...
 
int16 TCPSend (SOCKET s, const uint8 *src, uint16 len)
 TCP sending. More...
 
int16 TCPReSend (SOCKET s)
 TCP re-sending. More...
 
int16 TCPRecv (SOCKET s, uint8 *buf, uint16 len)
 TCP Reception. More...
 
int8 TCPClose (SOCKET s)
 TCP close. More...
 
int8 UDPOpen (SOCKET s, uint16 port)
 UDP open. More...
 
int16 UDPSend (SOCKET s, const uint8 *buf, uint16 len, uint8 *addr, uint16 port)
 UDP sending. More...
 
int16 UDPRecv (SOCKET s, uint8 *buf, uint16 len, uint8 *addr, uint16 *port)
 UDP reception. More...
 
uint8 GetInterrupt (SOCKET s)
 Gets the interrupt vector. todo. More...
 
void PutInterrupt (SOCKET s, uint8 vector)
 Puts the interrupt vector. todo. More...
 
uint16 GetSocketTxFreeBufferSize (SOCKET s)
 TX buffer size. More...
 
uint16 GetSocketRxRecvBufferSize (SOCKET s)
 RX buffer size. More...
 
void TSMART_W5200_Init (uint8_t TSMART_W5200_irq_mode)
 Wiznet(W5200) init. More...
 
void TSMART_W5200_HwReset (void)
 W5200 hardware reset. More...
 
void TSMART_W5200_IrqSocketEnable (void)
 IRQ Socket enable. More...
 

Detailed Description

Function Documentation

uint8 GetInterrupt ( SOCKET  s)

Gets the interrupt vector. todo.

This functions gets the interrupt vector vinculated to a specific socket.

Parameters
sSocket number.
Returns
  • Interrupt vector.
void GetNetInfo ( wiz_NetInfo netinfo)

Gets the network information.

Parameters
netinfoNetinfo structure.
Examples:
wiznet_dhcp_dns.c.
uint16 GetSocketRxRecvBufferSize ( SOCKET  s)

RX buffer size.

This function gets the RX recv buffer size.

Parameters
sSocket number.
Returns
  • Size of RX recv buffer size.
Examples:
wiznet_tcp_client.c, and wiznet_tcp_server.c.
uint16 GetSocketTxFreeBufferSize ( SOCKET  s)

TX buffer size.

This gives free buffer size of transmition buffer. It returns the data size that user can transmit. User should check this value first and control the size of transmitting data.

Parameters
sSocket number.
Returns
  • size of TX free buffer size.
int8 GetTCPSocketStatus ( SOCKET  s)

Gets the TCP socket status.

Parameters
sSocket number.
Returns
  • TCP socket status: STATUS_CLOSED, STATUS_INIT, STATUS_LISTEN, STATUS_SYNSENT, STATUS_SYNRECV, STATUS_ESTABLISHED, STATUS_FIN_WAIT,STATUS_CLOSING,STATUS_TIME_WAIT,STATUS_CLOSE_WAIT, STATUS_LAST_ACK, ERROR_NOT_TCP_SOCKET.
Examples:
wiznet_dhcp_dns.c.
int8 GetUDPSocketStatus ( SOCKET  s)

Gets the UDP socket status.

Parameters
sSocket number.
Returns
  • UDP socket status: STATUS_CLOSED, STATUS_UDP, ERROR_NOT_UDP_SOCKET.
void PutInterrupt ( SOCKET  s,
uint8  vector 
)

Puts the interrupt vector. todo.

This function links a interrupt vector to a specific socket.

Parameters
sSocket number.
vectorInterrupt vector.
void SetNetInfo ( wiz_NetInfo netinfo)

Sets the network information.

Parameters
netinfonetinfo structure.
Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
void SetSocketOption ( uint8  option_type,
uint16  option_value 
)

Sets the network option.

Parameters
option_typeOption type.
option_valueOption value.
int8 TCPClientOpen ( SOCKET  s,
uint16  port,
uint8 *  destip,
uint16  destport 
)

TCP Client Open.

This function opens a TCP client socket.

Parameters
sSocket number.
portLocal port number.
destipDestination IP address.
destportDestination port.
Returns
  • 1 - Success.
  • 0 - Fail.
Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, and wiznet_tcp_client.c.
int8 TCPClose ( SOCKET  s)

TCP close.

This function closes a TCP socket.

Parameters
sSocket number.
Returns
  • 1 - Success.
  • 0 - Fail.
Examples:
mqtt_wiznet_publisher.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
int16 TCPRecv ( SOCKET  s,
uint8 *  buf,
uint16  len 
)

TCP Reception.

This function is an application I/F function which is used to receive data in TCP mode. It waits for data as much as the application wants to receive.

Parameters
sSocket number.
bufMemory buffer to store received data.
lenLentgh to be received.
Returns
  • Data size received.
  • -1.
Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
int16 TCPReSend ( SOCKET  s)

TCP re-sending.

This function is used to re-send data in TCP mode.

Parameters
sSocket number.
Returns
  • 1 - Success.
  • 0 - Fail.
int16 TCPSend ( SOCKET  s,
const uint8 *  src,
uint16  len 
)

TCP sending.

This function used to send data in TCP mode.

Parameters
sSocket number.
srcData buffer to send.
lenNumber of bytes.
Returns
  • nb bytes sent.
  • Negative value for error cases.
Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
int8 TCPServerOpen ( SOCKET  s,
uint16  port 
)

TCP Server open.

This function opens a TCP server socket.

Parameters
sSocket number.
portNumber port enabled for server.
Returns
  • 1 - Success.
  • 0 - Fail.
Examples:
wiznet_dhcp_dns.c, and wiznet_tcp_server.c.
void TSMART_W5200_HwReset ( void  )

W5200 hardware reset.

This function resets the wiznet using a dedicated hardware line.

Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
void TSMART_W5200_Init ( uint8_t  TSMART_W5200_irq_mode)

Wiznet(W5200) init.

This function initializes the hardware configuration of the selected SPI bus and the associated OS mechanisms.

The TSMART_W5200_irq_mode parameter enables or disables the irq mode to work with wiznet sockets. if this parameter is set to 1, user shall execute TSMART_W5200_IrqSocketEnable() function. If 0, user must use API functions by polling.

Note
This Device use tsmart_spi2 and its associated pins
Parameters
TSMART_W5200_irq_modeIRQ enabler.
  • 1- Enabled.
  • 0- Disabled.
Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
void TSMART_W5200_IrqSocketEnable ( void  )

IRQ Socket enable.

This function enables the IRQ socket in wiznet device. User shall execute it after wizInit() function is executed. In addition, user shall be sure that the wiznet is initialized to work in IRQ mode.

Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
int8 UDPOpen ( SOCKET  s,
uint16  port 
)

UDP open.

This function opens a UDP socket.

Parameters
sSocket number.
portPort number to connect.
Returns
  • 1 - Success.
  • 0 - Fail.
int16 UDPRecv ( SOCKET  s,
uint8 *  buf,
uint16  len,
uint8 *  addr,
uint16 *  port 
)

UDP reception.

This function receives UDP data.

Parameters
sSocket number.
bufMemory buffer to store received data.
lenNumber of bytes.
addrRemote IP address.
portRemote port.
Returns
  • Data size received.
  • -1.
int16 UDPSend ( SOCKET  s,
const uint8 *  buf,
uint16  len,
uint8 *  addr,
uint16  port 
)

UDP sending.

This function is an application I/F function which is used to send UDP data. The peer's destination address and the port is needed.

Parameters
sNumber of socket.
bufData buffer to send.
lenNumber of bytes to send.
addrDestination IP address.
portDestination port.
Returns
  • Data size sent.
  • -1.
void wizInit ( )

Wiznet Init.

This function initializes the W5200.

Examples:
mqtt_wiznet_publisher.c, mqtt_wiznet_subscriber.c, wiznet_dhcp_dns.c, wiznet_tcp_client.c, and wiznet_tcp_server.c.
void wizMemInit ( uint8 *  tx_size,
uint8 *  rx_size 
)

Sets Tx/Rx buffer size.

This function sets the transmition/reception buffer size as per the channels.

Parameters
tx_sizeTransmition buffer size.
rx_sizeReception buffer size.
void wizSWReset ( )

Wiznet Software reset.

This function resets iinchip. In addtion, it initializes the iinchip to work in DIRECT or INDIRECT mode.

Examples:
wiznet_dhcp_dns.c.