Mbed library for ENC28J60 Ethernet modules. Full support for TCP/IP and UDP Server, Client and HTTP server (webserver). DHCP and DNS is included.
Dependents: mBuino_ENC28_MQTT Nucleo_Web_ENC28J60 Nucleo_Web_ENC28J60_ADC Serial_over_Ethernet ... more
Library for ENC28J60 Ethernet modules.
Ported to mbed from Norbert Truchsess's UIPEthernet library for Arduino. Thank you Norbert!
- Full support for persistent (streaming) TCP/IP and UDP connections Client and Server each, ARP, ICMP, DHCP and DNS.
- Works with both Mbed OS 2 and Mbed OS 5.
Usage:
- Import the library into your project.
- Add
#include "UipEthernet.h"
tomain.cpp
- Create one instance of the UipEthernet class initialized with the MAC address you'd like to use and SPI pins of the connected Mbed board.
Example programs:
Import programWebSwitch_ENC28J60
HTTP Server serving a simple webpage which enables to remotely turn a digital output on/off. Compile, download, run and type 'IP_address/secret/' (don't forget the last '/') into your web browser and hit ENTER.
Import programHTTPServer_Echo_ENC28J60
A simple HTTP server echoing received requests. Ethernet connection is over an ENC28J60 board. Usage: Type the server's IP address into you web browser and hit <ENTER>.
Import programTcpServer_ENC28J60
Simple TCP/IP Server using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programTcpClient_ENC28J60
Simple TCP/IP Client using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programUdpServer_ENC28J60
Simple UDP Server using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programUdpClient_ENC28J60
Simple UDP Client using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programMQTT_Hello_ENC28J60
MQTT Client example program. Ethernet connection is via an ENC28J60 module.
uitility/uip_arch.h
- Committer:
- hudakz
- Date:
- 2014-09-15
- Revision:
- 0:5350a66d5279
File content as of revision 0:5350a66d5279:
/** * \addtogroup uip * {@ */ /** * \defgroup uiparch Architecture specific uIP functions * @{ * * The functions in the architecture specific module implement the IP * check sum and 32-bit additions. * * The IP checksum calculation is the most computationally expensive * operation in the TCP/IP stack and it therefore pays off to * implement this in efficient assembler. The purpose of the uip-arch * module is to let the checksum functions to be implemented in * architecture specific assembler. * */ /** * \file * Declarations of architecture specific functions. * \author Adam Dunkels <adam@dunkels.com> */ /* * Copyright (c) 2001, Adam Dunkels. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * * This file is part of the uIP TCP/IP stack. * * $Id: uip_arch.h,v 1.2 2006/06/07 09:15:19 adam Exp $ * */ #ifndef __UIP_ARCH_H__ #define __UIP_ARCH_H__ #include "uip.h" /** * Carry out a 32-bit addition. * * Because not all architectures for which uIP is intended has native * 32-bit arithmetic, uIP uses an external C function for doing the * required 32-bit additions in the TCP protocol processing. This * function should add the two arguments and place the result in the * global variable uip_acc32. * * \note The 32-bit integer pointed to by the op32 parameter and the * result in the uip_acc32 variable are in network byte order (big * endian). * * \param op32 A pointer to a 4-byte array representing a 32-bit * integer in network byte order (big endian). * * \param op16 A 16-bit integer in host byte order. */ void uip_add32(u8_t* op32, u16_t op16); /** * Calculate the Internet checksum over a buffer. * * The Internet checksum is the one's complement of the one's * complement sum of all 16-bit words in the buffer. * * See RFC1071. * * \note This function is not called in the current version of uIP, * but future versions might make use of it. * * \param buf A pointer to the buffer over which the checksum is to be * computed. * * \param len The length of the buffer over which the checksum is to * be computed. * * \return The Internet checksum of the buffer. */ u16_t uip_chksum(u16_t* buf, u16_t len); /** * Calculate the IP header checksum of the packet header in uip_buf. * * The IP header checksum is the Internet checksum of the 20 bytes of * the IP header. * * \return The IP header checksum of the IP header in the uip_buf * buffer. */ u16_t uip_ipchksum(void); /** * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. * * The TCP checksum is the Internet checksum of data contents of the * TCP segment, and a pseudo-header as defined in RFC793. * * \note The uip_appdata pointer that points to the packet data may * point anywhere in memory, so it is not possible to simply calculate * the Internet checksum of the contents of the uip_buf buffer. * * \return The TCP checksum of the TCP segment in uip_buf and pointed * to by uip_appdata. */ u16_t uip_tcpchksum(void); u16_t uip_udpchksum(void); /** @} */ /** @} */ #endif /* __UIP_ARCH_H__ */