<?xml version='1.0' encoding='UTF-8' standalone='no'?> <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16"> <compounddef id="ethernetif_8c" kind="file" language="C++"> <compoundname>ethernetif.c</compoundname> <includes refid="lnc_8h" local="no">pci/lnc.h</includes> <includes refid="opt_8h" local="yes">net/opt.h</includes> <includes refid="tcpip_8h" local="no">net/tcpip.h</includes> <includes refid="def_8h" local="yes">net/def.h</includes> <includes refid="mem_8h" local="yes">net/mem.h</includes> <includes refid="pbuf_8h" local="yes">net/pbuf.h</includes> <includes refid="stats_8h" local="yes">net/stats.h</includes> <includes refid="snmp_8h" local="yes">net/snmp.h</includes> <includes refid="ethip6_8h" local="yes">net/ethip6.h</includes> <includes refid="etharp_8h" local="yes">net/etharp.h</includes> <incdepgraph> <node id="38"> <label>ufs/ufs.h</label> <link refid="ufs_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="39" relation="include"> </childnode> </node> <node id="18"> <label>stdarg.h</label> <link refid="stdarg_8h"/> </node> <node id="19"> <label>ubixos/kpanic.h</label> <link refid="kpanic_8h"/> </node> <node id="43"> <label>ubixos/sem.h</label> <link refid="sem_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="44" relation="include"> </childnode> <childnode refid="25" relation="include"> </childnode> </node> <node id="42"> <label>sys/tss.h</label> <link refid="tss_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="16"> <label>sys/io.h</label> <link refid="io_8h"/> </node> <node id="50"> <label>net/pbuf.h</label> <link refid="pbuf_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="44"> <label>ubixos/errno.h</label> <link refid="ubixos_2errno_8h"/> </node> <node id="41"> <label>ubixos/tty.h</label> <link refid="tty_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="55"> <label>net/priv/memp_priv.h</label> <link refid="memp__priv_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="52" relation="include"> </childnode> </node> <node id="31"> <label>i386/cpu.h</label> <link refid="i386_2cpu_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="5"> <label>sys/select.h</label> <link refid="select_8h"/> <childnode refid="6" relation="include"> </childnode> <childnode refid="4" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="8" relation="include"> </childnode> <childnode refid="9" relation="include"> </childnode> </node> <node id="34"> <label>vfs/inode.h</label> <link refid="inode_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="35" relation="include"> </childnode> <childnode refid="36" relation="include"> </childnode> <childnode refid="37" relation="include"> </childnode> <childnode refid="38" relation="include"> </childnode> </node> <node id="23"> <label>net/sys.h</label> <link refid="sys_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="24" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="22"> <label>net/timeouts.h</label> <link refid="timeouts_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> <childnode refid="23" relation="include"> </childnode> </node> <node id="56"> <label>net/snmp.h</label> <link refid="snmp_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="46" relation="include"> </childnode> </node> <node id="25"> <label>ubixos/ubthread.h</label> <link refid="ubthread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> <childnode refid="15" relation="include"> </childnode> </node> <node id="14"> <label>net/arch/cc.h</label> <link refid="cc_8h"/> <childnode refid="15" relation="include"> </childnode> </node> <node id="9"> <label>sys/_sigset.h</label> <link refid="__sigset_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="57"> <label>net/ethip6.h</label> <link refid="ethip6_8h"/> <childnode refid="10" relation="include"> </childnode> </node> <node id="52"> <label>net/mem.h</label> <link refid="mem_8h"/> <childnode refid="10" relation="include"> </childnode> </node> <node id="51"> <label>net/stats.h</label> <link refid="stats_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="52" relation="include"> </childnode> <childnode refid="53" relation="include"> </childnode> </node> <node id="11"> <label>net/lwipopts.h</label> <link refid="lwipopts_8h"/> </node> <node id="24"> <label>net/arch/sys_arch.h</label> <link refid="sys__arch_8h"/> <childnode refid="25" relation="include"> </childnode> <childnode refid="43" relation="include"> </childnode> </node> <node id="58"> <label>net/etharp.h</label> <link refid="etharp_8h"/> <childnode refid="10" relation="include"> </childnode> </node> <node id="40"> <label>vfs/mount.h</label> <link refid="mount_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="33"> <label>sys/resource.h</label> <link refid="resource_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="30"> <label>sys/trap.h</label> <link refid="trap_8h"/> <childnode refid="31" relation="include"> </childnode> </node> <node id="2"> <label>pci/lnc.h</label> <link refid="lnc_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="3"> <label>sys/types.h</label> <link refid="include_2sys_2types_8h"/> <childnode refid="4" relation="include"> </childnode> <childnode refid="5" relation="include"> </childnode> </node> <node id="20"> <label>net/tcpip.h</label> <link refid="tcpip_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> <childnode refid="22" relation="include"> </childnode> <childnode refid="45" relation="include"> </childnode> </node> <node id="27"> <label>vfs/file.h</label> <link refid="include_2vfs_2file_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="28" relation="include"> </childnode> <childnode refid="29" relation="include"> </childnode> <childnode refid="34" relation="include"> </childnode> <childnode refid="40" relation="include"> </childnode> <childnode refid="38" relation="include"> </childnode> </node> <node id="1"> <label>C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c</label> <link refid="ethernetif_8c"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="20" relation="include"> </childnode> <childnode refid="47" relation="include"> </childnode> <childnode refid="52" relation="include"> </childnode> <childnode refid="50" relation="include"> </childnode> <childnode refid="51" relation="include"> </childnode> <childnode refid="56" relation="include"> </childnode> <childnode refid="57" relation="include"> </childnode> <childnode refid="58" relation="include"> </childnode> </node> <node id="47"> <label>net/def.h</label> <link refid="def_8h"/> <childnode refid="13" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="45"> <label>net/netif.h</label> <link refid="netif_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> <childnode refid="46" relation="include"> </childnode> <childnode refid="47" relation="include"> </childnode> <childnode refid="50" relation="include"> </childnode> <childnode refid="51" relation="include"> </childnode> </node> <node id="13"> <label>net/arch.h</label> <link refid="arch_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="14" relation="include"> </childnode> <childnode refid="17" relation="include"> </childnode> <childnode refid="19" relation="include"> </childnode> </node> <node id="37"> <label>fs/msdos_fs.h</label> <link refid="msdos__fs_8h"/> </node> <node id="32"> <label>sys/signal.h</label> <link refid="sys_2signal_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="36"> <label>fs/pipe_fs.h</label> <link refid="pipe__fs_8h"/> </node> <node id="35"> <label>ubixos/wait.h</label> <link refid="wait_8h"/> </node> <node id="49"> <label>net/ip6_addr.h</label> <link refid="ip6__addr_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="47" relation="include"> </childnode> </node> <node id="10"> <label>net/opt.h</label> <link refid="opt_8h"/> <childnode refid="11" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> </node> <node id="17"> <label>lib/kprintf.h</label> <link refid="kprintf_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="18" relation="include"> </childnode> </node> <node id="12"> <label>net/debug.h</label> <link refid="debug_8h"/> <childnode refid="13" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="48"> <label>net/ip4_addr.h</label> <link refid="ip4__addr_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="47" relation="include"> </childnode> </node> <node id="46"> <label>net/ip_addr.h</label> <link refid="ip__addr_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="47" relation="include"> </childnode> <childnode refid="48" relation="include"> </childnode> <childnode refid="49" relation="include"> </childnode> </node> <node id="29"> <label>sys/thread.h</label> <link refid="thread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="30" relation="include"> </childnode> <childnode refid="32" relation="include"> </childnode> <childnode refid="33" relation="include"> </childnode> </node> <node id="54"> <label>net/priv/memp_std.h</label> <link refid="memp__std_8h"/> </node> <node id="6"> <label>sys/cdefs.h</label> <link refid="cdefs_8h"/> </node> <node id="15"> <label>ubixos/time.h</label> <link refid="time_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="16" relation="include"> </childnode> </node> <node id="26"> <label>ubixos/sched.h</label> <link refid="sched_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="27" relation="include"> </childnode> <childnode refid="41" relation="include"> </childnode> <childnode refid="42" relation="include"> </childnode> <childnode refid="29" relation="include"> </childnode> </node> <node id="4"> <label>sys/_types.h</label> <link refid="__types_8h"/> </node> <node id="21"> <label>net/err.h</label> <link refid="err_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> </node> <node id="7"> <label>sys/_timespec.h</label> <link refid="__timespec_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="39"> <label>sys/device.h</label> <link refid="include_2sys_2device_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="28"> <label>ubixfs/dirCache.h</label> <link refid="dirCache_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="8"> <label>sys/_timeval.h</label> <link refid="__timeval_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="53"> <label>net/memp.h</label> <link refid="memp_8h"/> <childnode refid="10" relation="include"> </childnode> <childnode refid="54" relation="include"> </childnode> <childnode refid="55" relation="include"> </childnode> <childnode refid="51" relation="include"> </childnode> </node> </incdepgraph> <innerclass refid="structethernetif" prot="public">ethernetif</innerclass> <sectiondef kind="define"> <memberdef kind="define" id="ethernetif_8c_1acd9e3df20507d5f895e80477aef74555" prot="public" static="no"> <name>IFNAME0</name> <initializer>'e'</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="60" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="60" bodyend="-1"/> </memberdef> <memberdef kind="define" id="ethernetif_8c_1a43b130296861cb255f1ad5b8c3787fd1" prot="public" static="no"> <name>IFNAME1</name> <initializer>'n'</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="61" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="61" bodyend="-1"/> </memberdef> </sectiondef> <sectiondef kind="var"> <memberdef kind="variable" id="ethernetif_8c_1a4a11421d92a3c6d8d9fae9db3bb9f299" prot="public" static="no" mutable="no"> <type>struct <ref refid="structnicBuffer" kindref="compound">nicBuffer</ref> *</type> <definition>struct nicBuffer* tmpBuf</definition> <argsstring></argsstring> <name>tmpBuf</name> <initializer>= 0x0</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="63" column="16" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="63" bodyend="-1"/> </memberdef> </sectiondef> <sectiondef kind="func"> <memberdef kind="function" id="ethernetif_8c_1a7ce979d0ec31575ecf17998b7bd9abb2" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type> <definition>err_t ethernetif_init</definition> <argsstring>(struct netif *netif)</argsstring> <name>ethernetif_init</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <briefdescription> </briefdescription> <detaileddescription> <para>Should be called at the beginning of the program to set up the network interface. It calls the function low_level_init() to do the actual setup of the hardware.</para> <para>This function should be passed as a parameter to <ref refid="group__netif_1ga66970b5877dd6b0cae906bfa78d0cb4c" kindref="member">netif_add()</ref>.</para> <para><parameterlist kind="param"><parameteritem> <parameternamelist> <parametername>netif</parametername> </parameternamelist> <parameterdescription> <para>the lwip network interface structure for this ethernetif </para> </parameterdescription> </parameteritem> </parameterlist> <simplesect kind="return"><para>ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error </para> </simplesect> </para> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="302" column="7" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="302" bodyend="344"/> <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" compoundref="err_8h" startline="65">ERR_MEM</references> <references refid="ethernetif_8c_1acd9e3df20507d5f895e80477aef74555" compoundref="ethernetif_8c" startline="60">IFNAME0</references> <references refid="ethernetif_8c_1a43b130296861cb255f1ad5b8c3787fd1" compoundref="ethernetif_8c" startline="61">IFNAME1</references> <references refid="structnetif_1acaaac9b415a7be73eb8a287c8ed18a8d" compoundref="netif_8h" startline="263">netif::linkoutput</references> <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references> <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references> <references refid="mem_8h_1a932aa40d85b14cb7331625e012d12335" compoundref="mem_8c" startline="603" endline="742">mem_malloc</references> <references refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" compoundref="netif_8h" startline="315">netif::name</references> <references refid="lwipopts_8h_1a2dfad02b075a7f9a8791a66fe40864a4" compoundref="lwipopts_8h" startline="433">NETIF_DEBUG</references> <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references> <references refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" compoundref="netif_8h" startline="287">netif::state</references> <referencedby refid="net_2init_8c_1a22b2914249628f6cba7d4e1f138c969f" compoundref="net_2init_8c" startline="52" endline="70">net_init</referencedby> </memberdef> <memberdef kind="function" id="ethernetif_8c_1a6b594ba7163978faa6f67288054079ac" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void ethernetif_input</definition> <argsstring>(struct netif *netif)</argsstring> <name>ethernetif_input</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <briefdescription> </briefdescription> <detaileddescription> <para>This function should be called when a packet is ready to be read from the interface. It uses the function low_level_input() that should handle the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called.</para> <para><parameterlist kind="param"><parameteritem> <parameternamelist> <parametername>netif</parametername> </parameternamelist> <parameterdescription> <para>the lwip network interface structure for this ethernetif </para> </parameterdescription> </parameteritem> </parameterlist> </para> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="270" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="270" bodyend="288"/> <references refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" compoundref="netif_8h" startline="287">netif::state</references> <referencedby refid="lnc_8c_1a6fb9d9c3d73ce2d10b2cebe1d71f07e2" compoundref="lnc_8c" startline="278" endline="314">lnc_thread</referencedby> </memberdef> <memberdef kind="function" id="ethernetif_8c_1a15915c49a70d85ff1c6af793cda34419" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>static void low_level_init</definition> <argsstring>(struct netif *netif)</argsstring> <name>low_level_init</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <briefdescription> </briefdescription> <detaileddescription> <para>In this function, the hardware should be initialized. Called from <ref refid="ethernetif_8c_1a7ce979d0ec31575ecf17998b7bd9abb2" kindref="member">ethernetif_init()</ref>.</para> <para><parameterlist kind="param"><parameteritem> <parameternamelist> <parametername>netif</parametername> </parameternamelist> <parameterdescription> <para>the already initialized lwip network interface structure for this ethernetif </para> </parameterdescription> </parameteritem> </parameterlist> </para> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="87" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="87" bodyend="123"/> </memberdef> <memberdef kind="function" id="ethernetif_8c_1a4160fbbf4831a305c3cef59f1b9ca461" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <definition>static struct pbuf* low_level_input</definition> <argsstring>(struct netif *netif)</argsstring> <name>low_level_input</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <briefdescription> </briefdescription> <detaileddescription> <para>Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf.</para> <para><parameterlist kind="param"><parameteritem> <parameternamelist> <parametername>netif</parametername> </parameternamelist> <parameterdescription> <para>the lwip network interface structure for this ethernetif </para> </parameterdescription> </parameteritem> </parameterlist> <simplesect kind="return"><para>a pbuf filled with the received packet (including MAC header) NULL on memory error </para> </simplesect> </para> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="192" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="192" bodyend="257"/> </memberdef> <memberdef kind="function" id="ethernetif_8c_1a00014ad0e69ae7ed01a084faa571ed34" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type> <definition>static err_t low_level_output</definition> <argsstring>(struct netif *netif, struct pbuf *p)</argsstring> <name>low_level_output</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <param> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <declname>p</declname> </param> <briefdescription> </briefdescription> <detaileddescription> <para>This function should do the actual transmission of the packet. The packet is contained in the pbuf that is passed to the function. This pbuf might be chained.</para> <para><parameterlist kind="param"><parameteritem> <parameternamelist> <parametername>netif</parametername> </parameternamelist> <parameterdescription> <para>the lwip network interface structure for this ethernetif </para> </parameterdescription> </parameteritem> <parameteritem> <parameternamelist> <parametername>p</parametername> </parameternamelist> <parameterdescription> <para>the MAC packet to send (e.g. IP packet including MAC addresses and type) </para> </parameterdescription> </parameteritem> </parameterlist> <simplesect kind="return"><para>ERR_OK if the packet could be sent an err_t value if the packet couldn't be sent</para> </simplesect> <simplesect kind="note"><para>Returning ERR_MEM here if a DMA queue of your MAC is full can lead to strange results. You might consider waiting for space in the DMA queue to become available since the stack doesn't retry to send a packet dropped because of memory failure (except for the TCP timers). </para> </simplesect> </para> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" line="142" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c" bodystart="142" bodyend="181"/> </memberdef> </sectiondef> <briefdescription> </briefdescription> <detaileddescription> <para>Ethernet Interface Skeleton </para> </detaileddescription> <programlisting> <codeline lineno="1"></codeline> <codeline lineno="7"><highlight class="comment">/*</highlight></codeline> <codeline lineno="8"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline> <codeline lineno="9"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline> <codeline lineno="10"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="11"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline> <codeline lineno="12"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline> <codeline lineno="13"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="14"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline> <codeline lineno="15"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline> <codeline lineno="16"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline> <codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline> <codeline lineno="18"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline> <codeline lineno="19"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline> <codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline> <codeline lineno="21"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="22"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS''<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline> <codeline lineno="23"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline> <codeline lineno="24"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline> <codeline lineno="25"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline> <codeline lineno="26"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline> <codeline lineno="27"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline> <codeline lineno="28"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline> <codeline lineno="29"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline> <codeline lineno="30"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline> <codeline lineno="31"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline> <codeline lineno="32"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="33"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline> <codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="35"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/><adam@sics.se></highlight></codeline> <codeline lineno="36"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="37"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="38"><highlight class="normal"></highlight></codeline> <codeline lineno="39"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="40"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>a<sp/>skeleton<sp/>for<sp/>developing<sp/>Ethernet<sp/>network<sp/>interface</highlight></codeline> <codeline lineno="41"><highlight class="comment"><sp/>*<sp/>drivers<sp/>for<sp/>lwIP.<sp/>Add<sp/>code<sp/>to<sp/>the<sp/>low_level<sp/>functions<sp/>and<sp/>do<sp/>a</highlight></codeline> <codeline lineno="42"><highlight class="comment"><sp/>*<sp/>search-and-replace<sp/>for<sp/>the<sp/>word<sp/>"ethernetif"<sp/>to<sp/>replace<sp/>it<sp/>with</highlight></codeline> <codeline lineno="43"><highlight class="comment"><sp/>*<sp/>something<sp/>that<sp/>better<sp/>describes<sp/>your<sp/>network<sp/>interface.</highlight></codeline> <codeline lineno="44"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="45"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="lnc_8h" kindref="compound">pci/lnc.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="46"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="opt_8h" kindref="compound">net/opt.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="47"><highlight class="normal"></highlight></codeline> <codeline lineno="48"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="tcpip_8h" kindref="compound">net/tcpip.h</ref>></highlight><highlight class="normal"><sp/></highlight><highlight class="comment">//TMP</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="49"><highlight class="normal"></highlight></codeline> <codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="def_8h" kindref="compound">net/def.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="mem_8h" kindref="compound">net/mem.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="52"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="pbuf_8h" kindref="compound">net/pbuf.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="stats_8h" kindref="compound">net/stats.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="54"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="snmp_8h" kindref="compound">net/snmp.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="ethip6_8h" kindref="compound">net/ethip6.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="56"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="etharp_8h" kindref="compound">net/etharp.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="57"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/>"net/ppp/pppoe.h"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="58"><highlight class="normal"></highlight></codeline> <codeline lineno="59"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Define<sp/>those<sp/>to<sp/>better<sp/>describe<sp/>your<sp/>network<sp/>interface.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="60" refid="ethernetif_8c_1acd9e3df20507d5f895e80477aef74555" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IFNAME0<sp/>'e'</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="61" refid="ethernetif_8c_1a43b130296861cb255f1ad5b8c3787fd1" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IFNAME1<sp/>'n'</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="62"><highlight class="normal"></highlight></codeline> <codeline lineno="63" refid="ethernetif_8c_1a4a11421d92a3c6d8d9fae9db3bb9f299" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnicBuffer" kindref="compound">nicBuffer</ref><sp/>*<ref refid="ethernetif_8c_1a4a11421d92a3c6d8d9fae9db3bb9f299" kindref="member">tmpBuf</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="64"><highlight class="normal"></highlight></codeline> <codeline lineno="71" refid="structethernetif" refkind="compound"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>{</highlight></codeline> <codeline lineno="72" refid="structethernetif_1a8f3049366ffe182fd1d4e0e2ce4542d7" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*<ref refid="structethernetif_1a8f3049366ffe182fd1d4e0e2ce4542d7" kindref="member">ethaddr</ref>;</highlight></codeline> <codeline lineno="73"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>whatever<sp/>per-interface<sp/>state<sp/>that<sp/>is<sp/>needed<sp/>here.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="74"><highlight class="normal">};</highlight></codeline> <codeline lineno="75"><highlight class="normal"></highlight></codeline> <codeline lineno="76"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Forward<sp/>declarations.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="77"><highlight class="normal"></highlight><highlight class="comment">//MrOlsen<sp/>2017-12-17<sp/>LWIP<sp/>static<sp/>void<sp/>ethernetif_input(struct<sp/>netif<sp/>*netif);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="78"><highlight class="normal"></highlight></codeline> <codeline lineno="86"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="87"><highlight class="normal">low_level_init(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline> <codeline lineno="88"><highlight class="normal">{</highlight></codeline> <codeline lineno="89"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>*<ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref>;</highlight></codeline> <codeline lineno="90"><highlight class="normal"></highlight></codeline> <codeline lineno="91"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>MAC<sp/>hardware<sp/>address<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="92"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>=<sp/><ref refid="prot_2etharp_8h_1a2c9ac5fe1c9f387f0df94d90cdc9c5c8" kindref="member">ETHARP_HWADDR_LEN</ref>;</highlight></codeline> <codeline lineno="93"><highlight class="normal"></highlight></codeline> <codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>MAC<sp/>hardware<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="95"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[0]<sp/>=<sp/>0x08;</highlight></codeline> <codeline lineno="96"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[1]<sp/>=<sp/>0x00;</highlight></codeline> <codeline lineno="97"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[2]<sp/>=<sp/>0x27;</highlight></codeline> <codeline lineno="98"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[3]<sp/>=<sp/>0x73;</highlight></codeline> <codeline lineno="99"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[4]<sp/>=<sp/>0xC1;</highlight></codeline> <codeline lineno="100"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[5]<sp/>=<sp/>0xB6;</highlight></codeline> <codeline lineno="101"><highlight class="normal"></highlight></codeline> <codeline lineno="102"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>maximum<sp/>transfer<sp/>unit<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="103"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>=<sp/>1500;</highlight></codeline> <codeline lineno="104"><highlight class="normal"></highlight></codeline> <codeline lineno="105"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>device<sp/>capabilities<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="106"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don't<sp/>set<sp/>NETIF_FLAG_ETHARP<sp/>if<sp/>this<sp/>device<sp/>is<sp/>not<sp/>an<sp/>ethernet<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="107"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>=<sp/><ref refid="group__netif__flags_1gaef64fe15c82bc7b235366923e517104e" kindref="member">NETIF_FLAG_BROADCAST</ref><sp/>|<sp/><ref refid="group__netif__flags_1ga92448dc510bc8d700c09e5c971ef0676" kindref="member">NETIF_FLAG_ETHARP</ref><sp/>|<sp/><ref refid="group__netif__flags_1ga75f5a2b9276c93e3bd18a568459fd2d8" kindref="member">NETIF_FLAG_LINK_UP</ref>;</highlight></codeline> <codeline lineno="108"><highlight class="normal"></highlight></codeline> <codeline lineno="109"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6<sp/>&&<sp/>LWIP_IPV6_MLD</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="110"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="111"><highlight class="comment"><sp/><sp/><sp/>*<sp/>For<sp/>hardware/netifs<sp/>that<sp/>implement<sp/>MAC<sp/>filtering.</highlight></codeline> <codeline lineno="112"><highlight class="comment"><sp/><sp/><sp/>*<sp/>All-nodes<sp/>link-local<sp/>is<sp/>handled<sp/>by<sp/>default,<sp/>so<sp/>we<sp/>must<sp/>let<sp/>the<sp/>hardware<sp/>know</highlight></codeline> <codeline lineno="113"><highlight class="comment"><sp/><sp/><sp/>*<sp/>to<sp/>allow<sp/>multicast<sp/>packets<sp/>in.</highlight></codeline> <codeline lineno="114"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Should<sp/>set<sp/>mld_mac_filter<sp/>previously.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="115"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>->mld_mac_filter<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline> <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>ip6_allnodes_ll;</highlight></codeline> <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll);</highlight></codeline> <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>->mld_mac_filter(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&ip6_allnodes_ll,<sp/><ref refid="netif_8h_1ab194ec4241fad8b6e9aac51e3ec23de0a4186fbaf94be956ea1a3b02cd1cccb1f" kindref="member">NETIF_ADD_MAC_FILTER</ref>);</highlight></codeline> <codeline lineno="119"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="120"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>&&<sp/>LWIP_IPV6_MLD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="121"><highlight class="normal"></highlight></codeline> <codeline lineno="122"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>whatever<sp/>else<sp/>is<sp/>needed<sp/>to<sp/>initialize<sp/>interface.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="123"><highlight class="normal">}</highlight></codeline> <codeline lineno="124"><highlight class="normal"></highlight></codeline> <codeline lineno="141"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline> <codeline lineno="142"><highlight class="normal">low_level_output(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline> <codeline lineno="143"><highlight class="normal">{</highlight></codeline> <codeline lineno="144"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>*<ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref>;</highlight></codeline> <codeline lineno="145"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline> <codeline lineno="146"><highlight class="normal"></highlight></codeline> <codeline lineno="147"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2017-12-17<sp/>LWIP<sp/>initiate<sp/>transfer();</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="148"><highlight class="normal"></highlight></codeline> <codeline lineno="149"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETH_PAD_SIZE</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="150"><highlight class="normal"><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/>-<ref refid="lwipopts_8h_1ad7fa3b356ca7e603e848b069c4cc6276" kindref="member">ETH_PAD_SIZE</ref>);<sp/></highlight><highlight class="comment">/*<sp/>drop<sp/>the<sp/>padding<sp/>word<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="151"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="152"><highlight class="normal"></highlight></codeline> <codeline lineno="153"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(q<sp/>=<sp/>p;<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>q<sp/>=<sp/>q-><ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline> <codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>the<sp/>data<sp/>from<sp/>the<sp/>pbuf<sp/>to<sp/>the<sp/>interface,<sp/>one<sp/>pbuf<sp/>at<sp/>a</highlight></codeline> <codeline lineno="155"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>time.<sp/>The<sp/>size<sp/>of<sp/>the<sp/>data<sp/>in<sp/>each<sp/>pbuf<sp/>is<sp/>kept<sp/>in<sp/>the<sp/>->len</highlight></codeline> <codeline lineno="156"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>variable.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//send<sp/>data<sp/>from(q->payload,<sp/>q->len);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lnc_8h_1a255b0c47c6efbe7b708b9aa4319c2bde" kindref="member">lnc_sendPacket</ref>(<ref refid="lnc_8h_1af5e66182cc3ee40ca7dab1a2449d002e" kindref="member">lnc</ref>,<sp/>q-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>q-><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,0x0);</highlight></codeline> <codeline lineno="159"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="160"><highlight class="normal"></highlight></codeline> <codeline lineno="161"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//signal<sp/>that<sp/>packet<sp/>should<sp/>be<sp/>sent();</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="162"><highlight class="normal"></highlight></codeline> <codeline lineno="163"><highlight class="normal"><sp/><sp/><ref refid="snmp_8h_1a05641438775014b7e13b9e55eba48bed" kindref="member">MIB2_STATS_NETIF_ADD</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifoutoctets,<sp/>p-><ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>);</highlight></codeline> <codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[0]<sp/>&<sp/>1)<sp/>{</highlight></codeline> <codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>or<sp/>multicast<sp/>packet*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a3c52caf566d37705c6547f2d025afd9f" kindref="member">MIB2_STATS_NETIF_INC</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifoutnucastpkts);</highlight></codeline> <codeline lineno="167"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="168"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>unicast<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a3c52caf566d37705c6547f2d025afd9f" kindref="member">MIB2_STATS_NETIF_INC</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifoutucastpkts);</highlight></codeline> <codeline lineno="171"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="172"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>increase<sp/>ifoutdiscards<sp/>or<sp/>ifouterrors<sp/>on<sp/>error<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="173"><highlight class="normal"></highlight></codeline> <codeline lineno="174"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETH_PAD_SIZE</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="175"><highlight class="normal"><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/><ref refid="lwipopts_8h_1ad7fa3b356ca7e603e848b069c4cc6276" kindref="member">ETH_PAD_SIZE</ref>);<sp/></highlight><highlight class="comment">/*<sp/>reclaim<sp/>the<sp/>padding<sp/>word<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="176"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="177"><highlight class="normal"></highlight></codeline> <codeline lineno="178"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a9b28a3eaea720ca831d4b33545b95871" kindref="member">LINK_STATS_INC</ref>(link.xmit);</highlight></codeline> <codeline lineno="179"><highlight class="normal"></highlight></codeline> <codeline lineno="180"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline> <codeline lineno="181"><highlight class="normal">}</highlight></codeline> <codeline lineno="182"><highlight class="normal"></highlight></codeline> <codeline lineno="191"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline> <codeline lineno="192"><highlight class="normal">low_level_input(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline> <codeline lineno="193"><highlight class="normal">{</highlight></codeline> <codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>*<ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref>;</highlight></codeline> <codeline lineno="195"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/>*q;</highlight></codeline> <codeline lineno="196"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a281b4b5562236420969a830503b0ba19" kindref="member">uint16_t</ref><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline> <codeline lineno="197"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*bufPtr;</highlight></codeline> <codeline lineno="198"><highlight class="normal"></highlight></codeline> <codeline lineno="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Obtain<sp/>the<sp/>size<sp/>of<sp/>the<sp/>packet<sp/>and<sp/>put<sp/>it<sp/>into<sp/>the<sp/>"len"</highlight></codeline> <codeline lineno="200"><highlight class="comment"><sp/><sp/><sp/>variable.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="201"><highlight class="normal"><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/><ref refid="ethernetif_8c_1a4a11421d92a3c6d8d9fae9db3bb9f299" kindref="member">tmpBuf</ref>-><ref refid="structnicBuffer_1a959ee09a7a6fc875f3d5d651576f37c4" kindref="member">length</ref>;</highlight></codeline> <codeline lineno="202"><highlight class="normal"><sp/><sp/>bufPtr<sp/>=<sp/><ref refid="ethernetif_8c_1a4a11421d92a3c6d8d9fae9db3bb9f299" kindref="member">tmpBuf</ref>-><ref refid="structnicBuffer_1a9679b6c2e76a7617884e422c11aa3eac" kindref="member">buffer</ref>;</highlight></codeline> <codeline lineno="203"><highlight class="normal"></highlight></codeline> <codeline lineno="204"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETH_PAD_SIZE</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="205"><highlight class="normal"><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>+=<sp/><ref refid="lwipopts_8h_1ad7fa3b356ca7e603e848b069c4cc6276" kindref="member">ETH_PAD_SIZE</ref>;<sp/></highlight><highlight class="comment">/*<sp/>allow<sp/>room<sp/>for<sp/>Ethernet<sp/>padding<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="206"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="207"><highlight class="normal"></highlight></codeline> <codeline lineno="208"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>allocate<sp/>a<sp/>pbuf<sp/>chain<sp/>of<sp/>pbufs<sp/>from<sp/>the<sp/>pool.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="209"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba" kindref="member">PBUF_RAW</ref>,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>);</highlight></codeline> <codeline lineno="210"><highlight class="normal"></highlight></codeline> <codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline> <codeline lineno="212"><highlight class="normal"></highlight></codeline> <codeline lineno="213"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETH_PAD_SIZE</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/>-<ref refid="lwipopts_8h_1ad7fa3b356ca7e603e848b069c4cc6276" kindref="member">ETH_PAD_SIZE</ref>);<sp/></highlight><highlight class="comment">/*<sp/>drop<sp/>the<sp/>padding<sp/>word<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="215"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="216"><highlight class="normal"></highlight></codeline> <codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>iterate<sp/>over<sp/>the<sp/>pbuf<sp/>chain<sp/>until<sp/>we<sp/>have<sp/>read<sp/>the<sp/>entire</highlight></codeline> <codeline lineno="218"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>packet<sp/>into<sp/>the<sp/>pbuf.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(q<sp/>=<sp/>p;<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>q<sp/>=<sp/>q-><ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline> <codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Read<sp/>enough<sp/>bytes<sp/>to<sp/>fill<sp/>this<sp/>pbuf<sp/>in<sp/>the<sp/>chain.<sp/>The</highlight></codeline> <codeline lineno="221"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>available<sp/>data<sp/>in<sp/>the<sp/>pbuf<sp/>is<sp/>given<sp/>by<sp/>the<sp/>q->len</highlight></codeline> <codeline lineno="222"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>variable.</highlight></codeline> <codeline lineno="223"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>This<sp/>does<sp/>not<sp/>necessarily<sp/>have<sp/>to<sp/>be<sp/>a<sp/>memcpy,<sp/>you<sp/>can<sp/>also<sp/>preallocate</highlight></codeline> <codeline lineno="224"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>pbufs<sp/>for<sp/>a<sp/>DMA-enabled<sp/>MAC<sp/>and<sp/>after<sp/>receiving<sp/>truncate<sp/>it<sp/>to<sp/>the</highlight></codeline> <codeline lineno="225"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>actually<sp/>received<sp/>size.<sp/>In<sp/>this<sp/>case,<sp/>ensure<sp/>the<sp/>tot_len<sp/>member<sp/>of<sp/>the</highlight></codeline> <codeline lineno="226"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>pbuf<sp/>is<sp/>the<sp/>sum<sp/>of<sp/>the<sp/>chained<sp/>pbuf<sp/>len<sp/>members.</highlight></codeline> <codeline lineno="227"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//read<sp/>data<sp/>into(q->payload,<sp/>q->len);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="gpt_8h_1a44c4efafeb8def719ad013ce4e3708d2" kindref="member">bcopy</ref>(bufPtr,<sp/>q-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>q-><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline> <codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>bufPtr<sp/>+=<sp/>q-><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline> <codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//acknowledge<sp/>that<sp/>packet<sp/>has<sp/>been<sp/>read();</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="233"><highlight class="normal"></highlight></codeline> <codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a05641438775014b7e13b9e55eba48bed" kindref="member">MIB2_STATS_NETIF_ADD</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifinoctets,<sp/>p-><ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>);</highlight></codeline> <codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[0]<sp/>&<sp/>1)<sp/>{</highlight></codeline> <codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>or<sp/>multicast<sp/>packet*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a3c52caf566d37705c6547f2d025afd9f" kindref="member">MIB2_STATS_NETIF_INC</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifinnucastpkts);</highlight></codeline> <codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>unicast<sp/>packet*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a3c52caf566d37705c6547f2d025afd9f" kindref="member">MIB2_STATS_NETIF_INC</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifinucastpkts);</highlight></codeline> <codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="243"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETH_PAD_SIZE</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/><ref refid="lwipopts_8h_1ad7fa3b356ca7e603e848b069c4cc6276" kindref="member">ETH_PAD_SIZE</ref>);<sp/></highlight><highlight class="comment">/*<sp/>reclaim<sp/>the<sp/>padding<sp/>word<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="245"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="246"><highlight class="normal"></highlight></codeline> <codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a9b28a3eaea720ca831d4b33545b95871" kindref="member">LINK_STATS_INC</ref>(link.recv);</highlight></codeline> <codeline lineno="248"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="249"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2017-12-17<sp/>LWIP<sp/>drop<sp/>packet();</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a9b28a3eaea720ca831d4b33545b95871" kindref="member">LINK_STATS_INC</ref>(link.memerr);</highlight></codeline> <codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a9b28a3eaea720ca831d4b33545b95871" kindref="member">LINK_STATS_INC</ref>(link.drop);</highlight></codeline> <codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="snmp_8h_1a3c52caf566d37705c6547f2d025afd9f" kindref="member">MIB2_STATS_NETIF_INC</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ifindiscards);</highlight></codeline> <codeline lineno="254"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="255"><highlight class="normal"></highlight></codeline> <codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline> <codeline lineno="257"><highlight class="normal">}</highlight></codeline> <codeline lineno="258"><highlight class="normal"></highlight></codeline> <codeline lineno="268"><highlight class="comment">/*<sp/>MrOlsen<sp/>2017-12-17<sp/>LWIP<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="269"><highlight class="normal"></highlight><highlight class="comment">//static<sp/>void<sp/>ethernetif_input(struct<sp/>netif<sp/>*netif)<sp/>{</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="270" refid="ethernetif_8c_1a6b594ba7163978faa6f67288054079ac" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="ethernetif_8c_1a6b594ba7163978faa6f67288054079ac" kindref="member">ethernetif_input</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>{</highlight></codeline> <codeline lineno="271"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>*<ref refid="structethernetif" kindref="compound">ethernetif</ref>;</highlight></codeline> <codeline lineno="272"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__hdr" kindref="compound">eth_hdr</ref><sp/>*ethhdr;</highlight></codeline> <codeline lineno="273"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline> <codeline lineno="274"><highlight class="normal"></highlight></codeline> <codeline lineno="275"><highlight class="normal"><sp/><sp/><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref>;</highlight></codeline> <codeline lineno="276"><highlight class="normal"></highlight></codeline> <codeline lineno="277"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>move<sp/>received<sp/>packet<sp/>into<sp/>a<sp/>new<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="278"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/>low_level_input(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline> <codeline lineno="279"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>no<sp/>packet<sp/>could<sp/>be<sp/>read,<sp/>silently<sp/>ignore<sp/>this<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="280"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline> <codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pass<sp/>all<sp/>packets<sp/>to<sp/>ethernet_input,<sp/>which<sp/>decides<sp/>what<sp/>packets<sp/>it<sp/>supports<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a8fe4f1b7b0d710216287da9615164a5c" kindref="member">input</ref>(p,<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline> <codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2dfad02b075a7f9a8791a66fe40864a4" kindref="member">NETIF_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">"ethernetif_input:<sp/>IP<sp/>input<sp/>error\n"</highlight><highlight class="normal">));</highlight></codeline> <codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline> <codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline> <codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="287"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="288"><highlight class="normal">}</highlight></codeline> <codeline lineno="289"><highlight class="normal"></highlight></codeline> <codeline lineno="302" refid="ethernetif_8c_1a7ce979d0ec31575ecf17998b7bd9abb2" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="ethernetif_8c_1a7ce979d0ec31575ecf17998b7bd9abb2" kindref="member">ethernetif_init</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>{</highlight></codeline> <codeline lineno="303"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>*<ref refid="structethernetif" kindref="compound">ethernetif</ref>;</highlight></codeline> <codeline lineno="304"><highlight class="normal"></highlight></codeline> <codeline lineno="305"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">"netif<sp/>!=<sp/>NULL"</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline> <codeline lineno="306"><highlight class="normal"></highlight></codeline> <codeline lineno="307"><highlight class="normal"><sp/><sp/><ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>=<sp/><ref refid="mem_8h_1a932aa40d85b14cb7331625e012d12335" kindref="member">mem_malloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structethernetif" kindref="compound">ethernetif</ref>));</highlight></codeline> <codeline lineno="308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structethernetif" kindref="compound">ethernetif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline> <codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2dfad02b075a7f9a8791a66fe40864a4" kindref="member">NETIF_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">"ethernetif_init:<sp/>out<sp/>of<sp/>memory\n"</highlight><highlight class="normal">));</highlight></codeline> <codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline> <codeline lineno="311"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="312"><highlight class="normal"></highlight></codeline> <codeline lineno="313"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="314"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Initialize<sp/>interface<sp/>hostname<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="315"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>->hostname<sp/>=<sp/></highlight><highlight class="stringliteral">"lwip"</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="316"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="317"><highlight class="normal"></highlight></codeline> <codeline lineno="318"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="319"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Initialize<sp/>the<sp/>snmp<sp/>variables<sp/>and<sp/>counters<sp/>inside<sp/>the<sp/>struct<sp/>netif.</highlight></codeline> <codeline lineno="320"><highlight class="comment"><sp/><sp/><sp/>*<sp/>The<sp/>last<sp/>argument<sp/>should<sp/>be<sp/>replaced<sp/>with<sp/>your<sp/>link<sp/>speed,<sp/>in<sp/>units</highlight></codeline> <codeline lineno="321"><highlight class="comment"><sp/><sp/><sp/>*<sp/>of<sp/>bits<sp/>per<sp/>second.</highlight></codeline> <codeline lineno="322"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="323"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2017-12-17<sp/>LWIP<sp/>MIB2_INIT_NETIF(netif,<sp/>snmp_ifType_ethernet_csmacd,<sp/>LINK_SPEED_OF_YOUR_NETIF_IN_BPS);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="324"><highlight class="normal"></highlight></codeline> <codeline lineno="325"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>=<sp/><ref refid="structethernetif" kindref="compound">ethernetif</ref>;</highlight></codeline> <codeline lineno="326"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0]<sp/>=<sp/><ref refid="ethernetif_8c_1acd9e3df20507d5f895e80477aef74555" kindref="member">IFNAME0</ref>;</highlight></codeline> <codeline lineno="327"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1]<sp/>=<sp/><ref refid="ethernetif_8c_1a43b130296861cb255f1ad5b8c3787fd1" kindref="member">IFNAME1</ref>;</highlight></codeline> <codeline lineno="328"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>directly<sp/>use<sp/>etharp_output()<sp/>here<sp/>to<sp/>save<sp/>a<sp/>function<sp/>call.</highlight></codeline> <codeline lineno="329"><highlight class="comment"><sp/><sp/><sp/>*<sp/>You<sp/>can<sp/>instead<sp/>declare<sp/>your<sp/>own<sp/>function<sp/>an<sp/>call<sp/>etharp_output()</highlight></codeline> <codeline lineno="330"><highlight class="comment"><sp/><sp/><sp/>*<sp/>from<sp/>it<sp/>if<sp/>you<sp/>have<sp/>to<sp/>do<sp/>some<sp/>checks<sp/>before<sp/>sending<sp/>(e.g.<sp/>if<sp/>link</highlight></codeline> <codeline lineno="331"><highlight class="comment"><sp/><sp/><sp/>*<sp/>is<sp/>available...)<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="332"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>->output<sp/>=<sp/>etharp_output;</highlight></codeline> <codeline lineno="333"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="334"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>->output_ip6<sp/>=<sp/>ethip6_output;</highlight></codeline> <codeline lineno="335"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="336"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1acaaac9b415a7be73eb8a287c8ed18a8d" kindref="member">linkoutput</ref><sp/>=<sp/>low_level_output;</highlight></codeline> <codeline lineno="337"><highlight class="normal"></highlight></codeline> <codeline lineno="338"><highlight class="normal"><sp/><sp/><ref refid="structethernetif" kindref="compound">ethernetif</ref>-><ref refid="structethernetif_1a8f3049366ffe182fd1d4e0e2ce4542d7" kindref="member">ethaddr</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)&(<ref refid="structnetif" kindref="compound">netif</ref>-><ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[0]);</highlight></codeline> <codeline lineno="339"><highlight class="normal"></highlight></codeline> <codeline lineno="340"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>initialize<sp/>the<sp/>hardware<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="341"><highlight class="normal"><sp/><sp/>low_level_init(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline> <codeline lineno="342"><highlight class="normal"></highlight></codeline> <codeline lineno="343"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline> <codeline lineno="344"><highlight class="normal">}</highlight></codeline> </programlisting> <location file="C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c"/> </compounddef> </doxygen>