Sam Walsh / F7_Ethernet

Dependents:   Nucleo_F746ZG_Ethernet_MQTT_Ultrasound

Fork of F7_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sun Jun 19 16:23:40 2016 +0000
Revision:
0:d26c1b55cfca
Ethernet Library for Nucleo stm32f746ZG and Disco stm32f746NG  works under arm and gcc environment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 /*
DieterGraef 0:d26c1b55cfca 2 * Copyright (c) 2002 CITEL Technologies Ltd.
DieterGraef 0:d26c1b55cfca 3 * All rights reserved.
DieterGraef 0:d26c1b55cfca 4 *
DieterGraef 0:d26c1b55cfca 5 * Redistribution and use in source and binary forms, with or without
DieterGraef 0:d26c1b55cfca 6 * modification, are permitted provided that the following conditions
DieterGraef 0:d26c1b55cfca 7 * are met:
DieterGraef 0:d26c1b55cfca 8 * 1. Redistributions of source code must retain the above copyright
DieterGraef 0:d26c1b55cfca 9 * notice, this list of conditions and the following disclaimer.
DieterGraef 0:d26c1b55cfca 10 * 2. Redistributions in binary form must reproduce the above copyright
DieterGraef 0:d26c1b55cfca 11 * notice, this list of conditions and the following disclaimer in the
DieterGraef 0:d26c1b55cfca 12 * documentation and/or other materials provided with the distribution.
DieterGraef 0:d26c1b55cfca 13 * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
DieterGraef 0:d26c1b55cfca 14 * may be used to endorse or promote products derived from this software
DieterGraef 0:d26c1b55cfca 15 * without specific prior written permission.
DieterGraef 0:d26c1b55cfca 16 *
DieterGraef 0:d26c1b55cfca 17 * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
DieterGraef 0:d26c1b55cfca 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
DieterGraef 0:d26c1b55cfca 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
DieterGraef 0:d26c1b55cfca 20 * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
DieterGraef 0:d26c1b55cfca 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DieterGraef 0:d26c1b55cfca 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
DieterGraef 0:d26c1b55cfca 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
DieterGraef 0:d26c1b55cfca 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
DieterGraef 0:d26c1b55cfca 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
DieterGraef 0:d26c1b55cfca 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
DieterGraef 0:d26c1b55cfca 27 * SUCH DAMAGE.
DieterGraef 0:d26c1b55cfca 28 *
DieterGraef 0:d26c1b55cfca 29 * This file is a contribution to the lwIP TCP/IP stack.
DieterGraef 0:d26c1b55cfca 30 * The Swedish Institute of Computer Science and Adam Dunkels
DieterGraef 0:d26c1b55cfca 31 * are specifically granted permission to redistribute this
DieterGraef 0:d26c1b55cfca 32 * source code.
DieterGraef 0:d26c1b55cfca 33 */
DieterGraef 0:d26c1b55cfca 34
DieterGraef 0:d26c1b55cfca 35 #ifndef __LWIP_IGMP_H__
DieterGraef 0:d26c1b55cfca 36 #define __LWIP_IGMP_H__
DieterGraef 0:d26c1b55cfca 37
DieterGraef 0:d26c1b55cfca 38 #include "lwip/opt.h"
DieterGraef 0:d26c1b55cfca 39 #include "lwip/ip_addr.h"
DieterGraef 0:d26c1b55cfca 40 #include "lwip/netif.h"
DieterGraef 0:d26c1b55cfca 41 #include "lwip/pbuf.h"
DieterGraef 0:d26c1b55cfca 42
DieterGraef 0:d26c1b55cfca 43 #if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
DieterGraef 0:d26c1b55cfca 44
DieterGraef 0:d26c1b55cfca 45 #ifdef __cplusplus
DieterGraef 0:d26c1b55cfca 46 extern "C" {
DieterGraef 0:d26c1b55cfca 47 #endif
DieterGraef 0:d26c1b55cfca 48
DieterGraef 0:d26c1b55cfca 49
DieterGraef 0:d26c1b55cfca 50 /* IGMP timer */
DieterGraef 0:d26c1b55cfca 51 #define IGMP_TMR_INTERVAL 100 /* Milliseconds */
DieterGraef 0:d26c1b55cfca 52 #define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL)
DieterGraef 0:d26c1b55cfca 53 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
DieterGraef 0:d26c1b55cfca 54
DieterGraef 0:d26c1b55cfca 55 /* MAC Filter Actions, these are passed to a netif's
DieterGraef 0:d26c1b55cfca 56 * igmp_mac_filter callback function. */
DieterGraef 0:d26c1b55cfca 57 #define IGMP_DEL_MAC_FILTER 0
DieterGraef 0:d26c1b55cfca 58 #define IGMP_ADD_MAC_FILTER 1
DieterGraef 0:d26c1b55cfca 59
DieterGraef 0:d26c1b55cfca 60
DieterGraef 0:d26c1b55cfca 61 /**
DieterGraef 0:d26c1b55cfca 62 * igmp group structure - there is
DieterGraef 0:d26c1b55cfca 63 * a list of groups for each interface
DieterGraef 0:d26c1b55cfca 64 * these should really be linked from the interface, but
DieterGraef 0:d26c1b55cfca 65 * if we keep them separate we will not affect the lwip original code
DieterGraef 0:d26c1b55cfca 66 * too much
DieterGraef 0:d26c1b55cfca 67 *
DieterGraef 0:d26c1b55cfca 68 * There will be a group for the all systems group address but this
DieterGraef 0:d26c1b55cfca 69 * will not run the state machine as it is used to kick off reports
DieterGraef 0:d26c1b55cfca 70 * from all the other groups
DieterGraef 0:d26c1b55cfca 71 */
DieterGraef 0:d26c1b55cfca 72 struct igmp_group {
DieterGraef 0:d26c1b55cfca 73 /** next link */
DieterGraef 0:d26c1b55cfca 74 struct igmp_group *next;
DieterGraef 0:d26c1b55cfca 75 /** interface on which the group is active */
DieterGraef 0:d26c1b55cfca 76 struct netif *netif;
DieterGraef 0:d26c1b55cfca 77 /** multicast address */
DieterGraef 0:d26c1b55cfca 78 ip_addr_t group_address;
DieterGraef 0:d26c1b55cfca 79 /** signifies we were the last person to report */
DieterGraef 0:d26c1b55cfca 80 u8_t last_reporter_flag;
DieterGraef 0:d26c1b55cfca 81 /** current state of the group */
DieterGraef 0:d26c1b55cfca 82 u8_t group_state;
DieterGraef 0:d26c1b55cfca 83 /** timer for reporting, negative is OFF */
DieterGraef 0:d26c1b55cfca 84 u16_t timer;
DieterGraef 0:d26c1b55cfca 85 /** counter of simultaneous uses */
DieterGraef 0:d26c1b55cfca 86 u8_t use;
DieterGraef 0:d26c1b55cfca 87 };
DieterGraef 0:d26c1b55cfca 88
DieterGraef 0:d26c1b55cfca 89 /* Prototypes */
DieterGraef 0:d26c1b55cfca 90 void igmp_init(void);
DieterGraef 0:d26c1b55cfca 91 err_t igmp_start(struct netif *netif);
DieterGraef 0:d26c1b55cfca 92 err_t igmp_stop(struct netif *netif);
DieterGraef 0:d26c1b55cfca 93 void igmp_report_groups(struct netif *netif);
DieterGraef 0:d26c1b55cfca 94 struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr);
DieterGraef 0:d26c1b55cfca 95 void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest);
DieterGraef 0:d26c1b55cfca 96 err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr);
DieterGraef 0:d26c1b55cfca 97 err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr);
DieterGraef 0:d26c1b55cfca 98 void igmp_tmr(void);
DieterGraef 0:d26c1b55cfca 99
DieterGraef 0:d26c1b55cfca 100 #ifdef __cplusplus
DieterGraef 0:d26c1b55cfca 101 }
DieterGraef 0:d26c1b55cfca 102 #endif
DieterGraef 0:d26c1b55cfca 103
DieterGraef 0:d26c1b55cfca 104 #endif /* LWIP_IGMP */
DieterGraef 0:d26c1b55cfca 105
DieterGraef 0:d26c1b55cfca 106 #endif /* __LWIP_IGMP_H__ */