ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:f9b6112278fe 1 /*
DieterGraef 0:f9b6112278fe 2 * Redistribution and use in source and binary forms, with or without modification,
DieterGraef 0:f9b6112278fe 3 * are permitted provided that the following conditions are met:
DieterGraef 0:f9b6112278fe 4 *
DieterGraef 0:f9b6112278fe 5 * 1. Redistributions of source code must retain the above copyright notice,
DieterGraef 0:f9b6112278fe 6 * this list of conditions and the following disclaimer.
DieterGraef 0:f9b6112278fe 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
DieterGraef 0:f9b6112278fe 8 * this list of conditions and the following disclaimer in the documentation
DieterGraef 0:f9b6112278fe 9 * and/or other materials provided with the distribution.
DieterGraef 0:f9b6112278fe 10 * 3. The name of the author may not be used to endorse or promote products
DieterGraef 0:f9b6112278fe 11 * derived from this software without specific prior written permission.
DieterGraef 0:f9b6112278fe 12 *
DieterGraef 0:f9b6112278fe 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
DieterGraef 0:f9b6112278fe 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
DieterGraef 0:f9b6112278fe 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
DieterGraef 0:f9b6112278fe 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
DieterGraef 0:f9b6112278fe 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
DieterGraef 0:f9b6112278fe 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
DieterGraef 0:f9b6112278fe 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
DieterGraef 0:f9b6112278fe 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
DieterGraef 0:f9b6112278fe 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
DieterGraef 0:f9b6112278fe 22 * OF SUCH DAMAGE.
DieterGraef 0:f9b6112278fe 23 *
DieterGraef 0:f9b6112278fe 24 * This file is part of the lwIP TCP/IP stack.
DieterGraef 0:f9b6112278fe 25 *
DieterGraef 0:f9b6112278fe 26 */
DieterGraef 0:f9b6112278fe 27
DieterGraef 0:f9b6112278fe 28 #ifndef __LWIP_NETIFAPI_H__
DieterGraef 0:f9b6112278fe 29 #define __LWIP_NETIFAPI_H__
DieterGraef 0:f9b6112278fe 30
DieterGraef 0:f9b6112278fe 31 #include "lwip/opt.h"
DieterGraef 0:f9b6112278fe 32
DieterGraef 0:f9b6112278fe 33 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
DieterGraef 0:f9b6112278fe 34
DieterGraef 0:f9b6112278fe 35 #include "lwip/sys.h"
DieterGraef 0:f9b6112278fe 36 #include "lwip/netif.h"
DieterGraef 0:f9b6112278fe 37 #include "lwip/dhcp.h"
DieterGraef 0:f9b6112278fe 38 #include "lwip/autoip.h"
DieterGraef 0:f9b6112278fe 39
DieterGraef 0:f9b6112278fe 40 #ifdef __cplusplus
DieterGraef 0:f9b6112278fe 41 extern "C" {
DieterGraef 0:f9b6112278fe 42 #endif
DieterGraef 0:f9b6112278fe 43
DieterGraef 0:f9b6112278fe 44 typedef void (*netifapi_void_fn)(struct netif *netif);
DieterGraef 0:f9b6112278fe 45 typedef err_t (*netifapi_errt_fn)(struct netif *netif);
DieterGraef 0:f9b6112278fe 46
DieterGraef 0:f9b6112278fe 47 struct netifapi_msg_msg {
DieterGraef 0:f9b6112278fe 48 #if !LWIP_TCPIP_CORE_LOCKING
DieterGraef 0:f9b6112278fe 49 sys_sem_t sem;
DieterGraef 0:f9b6112278fe 50 #endif /* !LWIP_TCPIP_CORE_LOCKING */
DieterGraef 0:f9b6112278fe 51 err_t err;
DieterGraef 0:f9b6112278fe 52 struct netif *netif;
DieterGraef 0:f9b6112278fe 53 union {
DieterGraef 0:f9b6112278fe 54 struct {
DieterGraef 0:f9b6112278fe 55 ip_addr_t *ipaddr;
DieterGraef 0:f9b6112278fe 56 ip_addr_t *netmask;
DieterGraef 0:f9b6112278fe 57 ip_addr_t *gw;
DieterGraef 0:f9b6112278fe 58 void *state;
DieterGraef 0:f9b6112278fe 59 netif_init_fn init;
DieterGraef 0:f9b6112278fe 60 netif_input_fn input;
DieterGraef 0:f9b6112278fe 61 } add;
DieterGraef 0:f9b6112278fe 62 struct {
DieterGraef 0:f9b6112278fe 63 netifapi_void_fn voidfunc;
DieterGraef 0:f9b6112278fe 64 netifapi_errt_fn errtfunc;
DieterGraef 0:f9b6112278fe 65 } common;
DieterGraef 0:f9b6112278fe 66 } msg;
DieterGraef 0:f9b6112278fe 67 };
DieterGraef 0:f9b6112278fe 68
DieterGraef 0:f9b6112278fe 69 struct netifapi_msg {
DieterGraef 0:f9b6112278fe 70 void (* function)(struct netifapi_msg_msg *msg);
DieterGraef 0:f9b6112278fe 71 struct netifapi_msg_msg msg;
DieterGraef 0:f9b6112278fe 72 };
DieterGraef 0:f9b6112278fe 73
DieterGraef 0:f9b6112278fe 74
DieterGraef 0:f9b6112278fe 75 /* API for application */
DieterGraef 0:f9b6112278fe 76 err_t netifapi_netif_add ( struct netif *netif,
DieterGraef 0:f9b6112278fe 77 ip_addr_t *ipaddr,
DieterGraef 0:f9b6112278fe 78 ip_addr_t *netmask,
DieterGraef 0:f9b6112278fe 79 ip_addr_t *gw,
DieterGraef 0:f9b6112278fe 80 void *state,
DieterGraef 0:f9b6112278fe 81 netif_init_fn init,
DieterGraef 0:f9b6112278fe 82 netif_input_fn input);
DieterGraef 0:f9b6112278fe 83
DieterGraef 0:f9b6112278fe 84 err_t netifapi_netif_set_addr ( struct netif *netif,
DieterGraef 0:f9b6112278fe 85 ip_addr_t *ipaddr,
DieterGraef 0:f9b6112278fe 86 ip_addr_t *netmask,
DieterGraef 0:f9b6112278fe 87 ip_addr_t *gw );
DieterGraef 0:f9b6112278fe 88
DieterGraef 0:f9b6112278fe 89 err_t netifapi_netif_common ( struct netif *netif,
DieterGraef 0:f9b6112278fe 90 netifapi_void_fn voidfunc,
DieterGraef 0:f9b6112278fe 91 netifapi_errt_fn errtfunc);
DieterGraef 0:f9b6112278fe 92
DieterGraef 0:f9b6112278fe 93 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
DieterGraef 0:f9b6112278fe 94 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
DieterGraef 0:f9b6112278fe 95 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
DieterGraef 0:f9b6112278fe 96 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
DieterGraef 0:f9b6112278fe 97 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
DieterGraef 0:f9b6112278fe 98 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
DieterGraef 0:f9b6112278fe 99 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
DieterGraef 0:f9b6112278fe 100 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
DieterGraef 0:f9b6112278fe 101
DieterGraef 0:f9b6112278fe 102 #ifdef __cplusplus
DieterGraef 0:f9b6112278fe 103 }
DieterGraef 0:f9b6112278fe 104 #endif
DieterGraef 0:f9b6112278fe 105
DieterGraef 0:f9b6112278fe 106 #endif /* LWIP_NETIF_API */
DieterGraef 0:f9b6112278fe 107
DieterGraef 0:f9b6112278fe 108 #endif /* __LWIP_NETIFAPI_H__ */