Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Thu Jun 23 09:04:23 2016 +0000
Revision:
1:28ba13dd96f7
Parent:
0:d26c1b55cfca
corrected MAC issue. The MAC is now 02:00:00:xx:xx:xx where xx is the sum over the unique device register

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 /**
DieterGraef 0:d26c1b55cfca 2 * @file
DieterGraef 0:d26c1b55cfca 3 * Statistics module
DieterGraef 0:d26c1b55cfca 4 *
DieterGraef 0:d26c1b55cfca 5 */
DieterGraef 0:d26c1b55cfca 6
DieterGraef 0:d26c1b55cfca 7 /*
DieterGraef 0:d26c1b55cfca 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
DieterGraef 0:d26c1b55cfca 9 * All rights reserved.
DieterGraef 0:d26c1b55cfca 10 *
DieterGraef 0:d26c1b55cfca 11 * Redistribution and use in source and binary forms, with or without modification,
DieterGraef 0:d26c1b55cfca 12 * are permitted provided that the following conditions are met:
DieterGraef 0:d26c1b55cfca 13 *
DieterGraef 0:d26c1b55cfca 14 * 1. Redistributions of source code must retain the above copyright notice,
DieterGraef 0:d26c1b55cfca 15 * this list of conditions and the following disclaimer.
DieterGraef 0:d26c1b55cfca 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
DieterGraef 0:d26c1b55cfca 17 * this list of conditions and the following disclaimer in the documentation
DieterGraef 0:d26c1b55cfca 18 * and/or other materials provided with the distribution.
DieterGraef 0:d26c1b55cfca 19 * 3. The name of the author may not be used to endorse or promote products
DieterGraef 0:d26c1b55cfca 20 * derived from this software without specific prior written permission.
DieterGraef 0:d26c1b55cfca 21 *
DieterGraef 0:d26c1b55cfca 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
DieterGraef 0:d26c1b55cfca 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
DieterGraef 0:d26c1b55cfca 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
DieterGraef 0:d26c1b55cfca 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
DieterGraef 0:d26c1b55cfca 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
DieterGraef 0:d26c1b55cfca 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
DieterGraef 0:d26c1b55cfca 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
DieterGraef 0:d26c1b55cfca 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
DieterGraef 0:d26c1b55cfca 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
DieterGraef 0:d26c1b55cfca 31 * OF SUCH DAMAGE.
DieterGraef 0:d26c1b55cfca 32 *
DieterGraef 0:d26c1b55cfca 33 * This file is part of the lwIP TCP/IP stack.
DieterGraef 0:d26c1b55cfca 34 *
DieterGraef 0:d26c1b55cfca 35 * Author: Adam Dunkels <adam@sics.se>
DieterGraef 0:d26c1b55cfca 36 *
DieterGraef 0:d26c1b55cfca 37 */
DieterGraef 0:d26c1b55cfca 38
DieterGraef 0:d26c1b55cfca 39 #include "lwip/opt.h"
DieterGraef 0:d26c1b55cfca 40
DieterGraef 0:d26c1b55cfca 41 #if LWIP_STATS /* don't build if not configured for use in lwipopts.h */
DieterGraef 0:d26c1b55cfca 42
DieterGraef 0:d26c1b55cfca 43 #include "lwip/def.h"
DieterGraef 0:d26c1b55cfca 44 #include "lwip/stats.h"
DieterGraef 0:d26c1b55cfca 45 #include "lwip/mem.h"
DieterGraef 0:d26c1b55cfca 46
DieterGraef 0:d26c1b55cfca 47 #include <string.h>
DieterGraef 0:d26c1b55cfca 48
DieterGraef 0:d26c1b55cfca 49 struct stats_ lwip_stats;
DieterGraef 0:d26c1b55cfca 50
DieterGraef 0:d26c1b55cfca 51 void stats_init(void)
DieterGraef 0:d26c1b55cfca 52 {
DieterGraef 0:d26c1b55cfca 53 #ifdef LWIP_DEBUG
DieterGraef 0:d26c1b55cfca 54 #if MEMP_STATS
DieterGraef 0:d26c1b55cfca 55 const char * memp_names[] = {
DieterGraef 0:d26c1b55cfca 56 #define LWIP_MEMPOOL(name,num,size,desc) desc,
DieterGraef 0:d26c1b55cfca 57 #include "lwip/memp_std.h"
DieterGraef 0:d26c1b55cfca 58 };
DieterGraef 0:d26c1b55cfca 59 int i;
DieterGraef 0:d26c1b55cfca 60 for (i = 0; i < MEMP_MAX; i++) {
DieterGraef 0:d26c1b55cfca 61 lwip_stats.memp[i].name = memp_names[i];
DieterGraef 0:d26c1b55cfca 62 }
DieterGraef 0:d26c1b55cfca 63 #endif /* MEMP_STATS */
DieterGraef 0:d26c1b55cfca 64 #if MEM_STATS
DieterGraef 0:d26c1b55cfca 65 lwip_stats.mem.name = "MEM";
DieterGraef 0:d26c1b55cfca 66 #endif /* MEM_STATS */
DieterGraef 0:d26c1b55cfca 67 #endif /* LWIP_DEBUG */
DieterGraef 0:d26c1b55cfca 68 }
DieterGraef 0:d26c1b55cfca 69
DieterGraef 0:d26c1b55cfca 70 #if LWIP_STATS_DISPLAY
DieterGraef 0:d26c1b55cfca 71 void
DieterGraef 0:d26c1b55cfca 72 stats_display_proto(struct stats_proto *proto, const char *name)
DieterGraef 0:d26c1b55cfca 73 {
DieterGraef 0:d26c1b55cfca 74 LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
DieterGraef 0:d26c1b55cfca 75 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit));
DieterGraef 0:d26c1b55cfca 76 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv));
DieterGraef 0:d26c1b55cfca 77 LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw));
DieterGraef 0:d26c1b55cfca 78 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop));
DieterGraef 0:d26c1b55cfca 79 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr));
DieterGraef 0:d26c1b55cfca 80 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr));
DieterGraef 0:d26c1b55cfca 81 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr));
DieterGraef 0:d26c1b55cfca 82 LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr));
DieterGraef 0:d26c1b55cfca 83 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr));
DieterGraef 0:d26c1b55cfca 84 LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr));
DieterGraef 0:d26c1b55cfca 85 LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err));
DieterGraef 0:d26c1b55cfca 86 LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit));
DieterGraef 0:d26c1b55cfca 87 }
DieterGraef 0:d26c1b55cfca 88
DieterGraef 0:d26c1b55cfca 89 #if IGMP_STATS
DieterGraef 0:d26c1b55cfca 90 void
DieterGraef 0:d26c1b55cfca 91 stats_display_igmp(struct stats_igmp *igmp)
DieterGraef 0:d26c1b55cfca 92 {
DieterGraef 0:d26c1b55cfca 93 LWIP_PLATFORM_DIAG(("\nIGMP\n\t"));
DieterGraef 0:d26c1b55cfca 94 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", igmp->xmit));
DieterGraef 0:d26c1b55cfca 95 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", igmp->recv));
DieterGraef 0:d26c1b55cfca 96 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", igmp->drop));
DieterGraef 0:d26c1b55cfca 97 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr));
DieterGraef 0:d26c1b55cfca 98 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr));
DieterGraef 0:d26c1b55cfca 99 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", igmp->memerr));
DieterGraef 0:d26c1b55cfca 100 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", igmp->proterr));
DieterGraef 0:d26c1b55cfca 101 LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F"\n\t", igmp->rx_v1));
DieterGraef 0:d26c1b55cfca 102 LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F"\n", igmp->rx_group));
DieterGraef 0:d26c1b55cfca 103 LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F"\n", igmp->rx_general));
DieterGraef 0:d26c1b55cfca 104 LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F"\n\t", igmp->rx_report));
DieterGraef 0:d26c1b55cfca 105 LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F"\n\t", igmp->tx_join));
DieterGraef 0:d26c1b55cfca 106 LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F"\n\t", igmp->tx_leave));
DieterGraef 0:d26c1b55cfca 107 LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F"\n\t", igmp->tx_report));
DieterGraef 0:d26c1b55cfca 108 }
DieterGraef 0:d26c1b55cfca 109 #endif /* IGMP_STATS */
DieterGraef 0:d26c1b55cfca 110
DieterGraef 0:d26c1b55cfca 111 #if MEM_STATS || MEMP_STATS
DieterGraef 0:d26c1b55cfca 112 void
DieterGraef 0:d26c1b55cfca 113 stats_display_mem(struct stats_mem *mem, const char *name)
DieterGraef 0:d26c1b55cfca 114 {
DieterGraef 0:d26c1b55cfca 115 LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
DieterGraef 0:d26c1b55cfca 116 LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail));
DieterGraef 0:d26c1b55cfca 117 LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used));
DieterGraef 0:d26c1b55cfca 118 LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max));
DieterGraef 0:d26c1b55cfca 119 LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
DieterGraef 0:d26c1b55cfca 120 }
DieterGraef 0:d26c1b55cfca 121
DieterGraef 0:d26c1b55cfca 122 #if MEMP_STATS
DieterGraef 0:d26c1b55cfca 123 void
DieterGraef 0:d26c1b55cfca 124 stats_display_memp(struct stats_mem *mem, int index)
DieterGraef 0:d26c1b55cfca 125 {
DieterGraef 0:d26c1b55cfca 126 char * memp_names[] = {
DieterGraef 0:d26c1b55cfca 127 #define LWIP_MEMPOOL(name,num,size,desc) desc,
DieterGraef 0:d26c1b55cfca 128 #include "lwip/memp_std.h"
DieterGraef 0:d26c1b55cfca 129 };
DieterGraef 0:d26c1b55cfca 130 if(index < MEMP_MAX) {
DieterGraef 0:d26c1b55cfca 131 stats_display_mem(mem, memp_names[index]);
DieterGraef 0:d26c1b55cfca 132 }
DieterGraef 0:d26c1b55cfca 133 }
DieterGraef 0:d26c1b55cfca 134 #endif /* MEMP_STATS */
DieterGraef 0:d26c1b55cfca 135 #endif /* MEM_STATS || MEMP_STATS */
DieterGraef 0:d26c1b55cfca 136
DieterGraef 0:d26c1b55cfca 137 #if SYS_STATS
DieterGraef 0:d26c1b55cfca 138 void
DieterGraef 0:d26c1b55cfca 139 stats_display_sys(struct stats_sys *sys)
DieterGraef 0:d26c1b55cfca 140 {
DieterGraef 0:d26c1b55cfca 141 LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
DieterGraef 0:d26c1b55cfca 142 LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used));
DieterGraef 0:d26c1b55cfca 143 LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max));
DieterGraef 0:d26c1b55cfca 144 LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err));
DieterGraef 0:d26c1b55cfca 145 LWIP_PLATFORM_DIAG(("mutex.used: %"U32_F"\n\t", (u32_t)sys->mutex.used));
DieterGraef 0:d26c1b55cfca 146 LWIP_PLATFORM_DIAG(("mutex.max: %"U32_F"\n\t", (u32_t)sys->mutex.max));
DieterGraef 0:d26c1b55cfca 147 LWIP_PLATFORM_DIAG(("mutex.err: %"U32_F"\n\t", (u32_t)sys->mutex.err));
DieterGraef 0:d26c1b55cfca 148 LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used));
DieterGraef 0:d26c1b55cfca 149 LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max));
DieterGraef 0:d26c1b55cfca 150 LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err));
DieterGraef 0:d26c1b55cfca 151 }
DieterGraef 0:d26c1b55cfca 152 #endif /* SYS_STATS */
DieterGraef 0:d26c1b55cfca 153
DieterGraef 0:d26c1b55cfca 154 void
DieterGraef 0:d26c1b55cfca 155 stats_display(void)
DieterGraef 0:d26c1b55cfca 156 {
DieterGraef 0:d26c1b55cfca 157 s16_t i;
DieterGraef 0:d26c1b55cfca 158
DieterGraef 0:d26c1b55cfca 159 LINK_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 160 ETHARP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 161 IPFRAG_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 162 IP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 163 IGMP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 164 ICMP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 165 UDP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 166 TCP_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 167 MEM_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 168 for (i = 0; i < MEMP_MAX; i++) {
DieterGraef 0:d26c1b55cfca 169 MEMP_STATS_DISPLAY(i);
DieterGraef 0:d26c1b55cfca 170 }
DieterGraef 0:d26c1b55cfca 171 SYS_STATS_DISPLAY();
DieterGraef 0:d26c1b55cfca 172 }
DieterGraef 0:d26c1b55cfca 173 #endif /* LWIP_STATS_DISPLAY */
DieterGraef 0:d26c1b55cfca 174
DieterGraef 0:d26c1b55cfca 175 #endif /* LWIP_STATS */
DieterGraef 0:d26c1b55cfca 176