<?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="sys__arch_8c" kind="file" language="C++">
    <compoundname>sys_arch.c</compoundname>
    <includes refid="include_2sys_2types_8h" local="no">sys/types.h</includes>
    <includes refid="sched_8h" local="no">ubixos/sched.h</includes>
    <includes refid="ubthread_8h" local="no">ubixos/ubthread.h</includes>
    <includes refid="kpanic_8h" local="no">ubixos/kpanic.h</includes>
    <includes refid="kprintf_8h" local="no">lib/kprintf.h</includes>
    <includes refid="kmalloc_8h" local="no">lib/kmalloc.h</includes>
    <includes refid="sysproto__posix_8h" local="no">sys/sysproto_posix.h</includes>
    <includes refid="descrip_8h" local="no">sys/descrip.h</includes>
    <includes refid="debug_8h" local="yes">net/debug.h</includes>
    <includes refid="sys_8h" local="yes">net/sys.h</includes>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <includes refid="stats_8h" local="yes">net/stats.h</includes>
    <includes refid="sys__arch_8h" local="no">net/arch/sys_arch.h</includes>
    <includes refid="spinlock_8h" local="no">ubixos/spinlock.h</includes>
    <includes refid="sem_8h" local="no">ubixos/sem.h</includes>
    <incdepgraph>
      <node id="36">
        <label>sys/fcntl.h</label>
        <link refid="fcntl_8h"/>
      </node>
      <node id="21">
        <label>ufs/ufs.h</label>
        <link refid="ufs_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
      </node>
      <node id="34">
        <label>sys/descrip.h</label>
        <link refid="descrip_8h"/>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="35" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
      </node>
      <node id="31">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="29">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="44">
        <label>ubixos/sem.h</label>
        <link refid="sem_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="45" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
      </node>
      <node id="25">
        <label>sys/tss.h</label>
        <link refid="tss_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="28">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="45">
        <label>ubixos/errno.h</label>
        <link refid="ubixos_2errno_8h"/>
      </node>
      <node id="24">
        <label>ubixos/tty.h</label>
        <link refid="tty_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="51">
        <label>net/priv/memp_priv.h</label>
        <link refid="memp__priv_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="48" relation="include">
        </childnode>
      </node>
      <node id="14">
        <label>i386/cpu.h</label>
        <link refid="i386_2cpu_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="17">
        <label>vfs/inode.h</label>
        <link refid="inode_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="42">
        <label>net/sys.h</label>
        <link refid="sys_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="43" relation="include">
        </childnode>
        <childnode refid="46" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/net/sys_arch.c</label>
        <link refid="sys__arch_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
        <childnode refid="34" relation="include">
        </childnode>
        <childnode refid="37" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="47" relation="include">
        </childnode>
        <childnode refid="43" relation="include">
        </childnode>
        <childnode refid="52" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
      </node>
      <node id="26">
        <label>ubixos/ubthread.h</label>
        <link refid="ubthread_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
      </node>
      <node id="52">
        <label>ubixos/spinlock.h</label>
        <link refid="spinlock_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="39">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="27" relation="include">
        </childnode>
      </node>
      <node id="8">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="32">
        <label>lib/kmalloc.h</label>
        <link refid="kmalloc_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="48">
        <label>net/mem.h</label>
        <link refid="mem_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
      </node>
      <node id="47">
        <label>net/stats.h</label>
        <link refid="stats_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="48" relation="include">
        </childnode>
        <childnode refid="49" relation="include">
        </childnode>
      </node>
      <node id="41">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="43">
        <label>net/arch/sys_arch.h</label>
        <link refid="sys__arch_8h"/>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
      </node>
      <node id="23">
        <label>vfs/mount.h</label>
        <link refid="mount_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>sys/resource.h</label>
        <link refid="resource_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>sys/trap.h</label>
        <link refid="trap_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>vfs/file.h</label>
        <link refid="include_2vfs_2file_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="38">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="39" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
      </node>
      <node id="20">
        <label>fs/msdos_fs.h</label>
        <link refid="msdos__fs_8h"/>
      </node>
      <node id="15">
        <label>sys/signal.h</label>
        <link refid="sys_2signal_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>fs/pipe_fs.h</label>
        <link refid="pipe__fs_8h"/>
      </node>
      <node id="18">
        <label>ubixos/wait.h</label>
        <link refid="wait_8h"/>
      </node>
      <node id="40">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="41" relation="include">
        </childnode>
        <childnode refid="37" relation="include">
        </childnode>
      </node>
      <node id="30">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="31" relation="include">
        </childnode>
      </node>
      <node id="37">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="38" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/thread.h</label>
        <link refid="thread_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
      </node>
      <node id="50">
        <label>net/priv/memp_std.h</label>
        <link refid="memp__std_8h"/>
      </node>
      <node id="5">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="27">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>ubixos/sched.h</label>
        <link refid="sched_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="46">
        <label>net/err.h</label>
        <link refid="err_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="38" relation="include">
        </childnode>
      </node>
      <node id="6">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="22">
        <label>sys/device.h</label>
        <link refid="include_2sys_2device_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="33">
        <label>sys/sysproto_posix.h</label>
        <link refid="sysproto__posix_8h"/>
        <childnode refid="15" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>ubixfs/dirCache.h</label>
        <link refid="dirCache_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="35">
        <label>vfs/stat.h</label>
        <link refid="stat_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="49">
        <label>net/memp.h</label>
        <link refid="memp_8h"/>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="50" relation="include">
        </childnode>
        <childnode refid="51" relation="include">
        </childnode>
        <childnode refid="47" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <innerclass refid="structthread__start__param" prot="public">thread_start_param</innerclass>
      <sectiondef kind="define">
      <memberdef kind="define" id="sys__arch_8c_1a2047048fa208fc8af0415adbdd1a8058" prot="public" static="no">
        <name>ERR_NOT_READY</name>
        <initializer>0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="20" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="20" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="sys__arch_8c_1a8accf4162b03c91a5f0966f31b965919" prot="public" static="no">
        <name>ERR_TIMED_OUT</name>
        <initializer>1</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="21" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="21" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="sys__arch_8c_1ad6d23821ba98486c430e44681e2cb4c2" prot="public" static="no">
        <name>INFINITE_TIME</name>
        <initializer>0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="22" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="22" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="var">
      <memberdef kind="variable" id="sys__arch_8c_1aac30a23253ab9a9514ea86c40815d53b" prot="public" static="yes" mutable="no">
        <type>struct <ref refid="structspinLock" kindref="compound">spinLock</ref></type>
        <definition>struct spinLock netThreadSpinlock</definition>
        <argsstring></argsstring>
        <name>netThreadSpinlock</name>
        <initializer>= <ref refid="spinlock_8h_1a0fe85a4f3642683148b25916d6c5eafd" kindref="member">SPIN_LOCK_INITIALIZER</ref></initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="38" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="25" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="sys__arch_8c_1a726d4f4e11d7b38233574938939e0db9" prot="public" static="yes" mutable="no">
        <type>struct <ref refid="structtimeval" kindref="compound">timeval</ref></type>
        <definition>struct timeval starttime</definition>
        <argsstring></argsstring>
        <name>starttime</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="38" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="24" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="sys__arch_8c_1a15905349139e42ffd3f853e8daae250f" prot="public" static="yes" mutable="no">
        <type>struct <ref refid="structsys__thread" kindref="compound">sys_thread</ref> *</type>
        <definition>struct sys_thread* threads</definition>
        <argsstring></argsstring>
        <name>threads</name>
        <initializer>= 0x0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="26" column="24" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="26" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="sys__arch_8c_1aeb46b057b0ccf2b6583e70d09454f3f6" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>static uint32_t cond_wait</definition>
        <argsstring>(ubthread_cond_t *cond, ubthread_mutex_t *mutex, uint32_t timeout)</argsstring>
        <name>cond_wait</name>
        <param>
          <type><ref refid="ubthread_8h_1a96521d8547d8b54e20e6f18d83c06901" kindref="member">ubthread_cond_t</ref> *</type>
          <declname>cond</declname>
        </param>
        <param>
          <type><ref refid="ubthread_8h_1a2b33c44e0ad37a62d92aaeeb011860e0" kindref="member">ubthread_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <param>
          <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="418" column="17" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="418" bodyend="455" declfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" declline="28" declcolumn="17"/>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1ac216bafdd6453f68ef27dc764b134e94" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structsys__thread" kindref="compound">sys_thread</ref> *</type>
        <definition>static struct sys_thread* current_thread</definition>
        <argsstring>(void)</argsstring>
        <name>current_thread</name>
        <param>
          <type>void</type>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="457" column="24" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="457" bodyend="475"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t sys_arch_mbox_fetch</definition>
        <argsstring>(struct sys_mbox **mb, void **msg, uint32_t timeout)</argsstring>
        <name>sys_arch_mbox_fetch</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <param>
          <type>void **</type>
          <declname>msg</declname>
        </param>
        <param>
          <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Wait for a new message to arrive in the mbox <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>mbox to get a message from </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>msg</parametername>
</parameternamelist>
<parameterdescription>
<para>pointer where the message is stored </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>timeout</parametername>
</parameternamelist>
<parameterdescription>
<para>maximum time (in milliseconds) to wait for a message (0 = wait forever) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>time (in milliseconds) waited for a message, may be 0 if not waited or SYS_ARCH_TIMEOUT on timeout The returned time has to be accurate to prevent timer jitter! </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="287" column="10" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="287" bodyend="334"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1ga3e0e0f02be2f670ebfb093a21f7dcdb8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t sys_arch_mbox_tryfetch</definition>
        <argsstring>(struct sys_mbox **mb, void **msg)</argsstring>
        <name>sys_arch_mbox_tryfetch</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <param>
          <type>void **</type>
          <declname>msg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Wait for a new message to arrive in the mbox <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>mbox to get a message from </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>msg</parametername>
</parameternamelist>
<parameterdescription>
<para>pointer where the message is stored </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>0 (milliseconds) if a message has been received or SYS_MBOX_EMPTY if the mailbox is empty </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="336" column="10" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="336" bodyend="365"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t sys_arch_sem_wait</definition>
        <argsstring>(struct sys_sem **s, uint32_t timeout)</argsstring>
        <name>sys_arch_sem_wait</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> **</type>
          <declname>s</declname>
        </param>
        <param>
          <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Wait for a semaphore for the specified timeout <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>sem</parametername>
</parameternamelist>
<parameterdescription>
<para>the semaphore to wait for </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>timeout</parametername>
</parameternamelist>
<parameterdescription>
<para>timeout in milliseconds to wait (0 = wait forever) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>time (in milliseconds) waited for the semaphore or SYS_ARCH_TIMEOUT on timeout </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="105" column="10" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="105" bodyend="130"/>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" compoundref="ubthread_8c" startline="88" endline="107">ubthread_mutex_lock</references>
        <references refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" compoundref="sem_8h" startline="39">sys_sem::mutex</references>
        <references refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" compoundref="sem_8h" startline="37">sys_sem::signaled</references>
        <referencedby refid="group__sys__misc_1ga6b8786f43e779953e8b74e983c88682e" compoundref="sys_8c" startline="93" endline="103">sys_msleep</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1a2ffdebd63f7a80c0233aa7460a816dff" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structsys__timeouts" kindref="compound">sys_timeouts</ref> *</type>
        <definition>struct sys_timeouts* sys_arch_timeouts</definition>
        <argsstring>(void)</argsstring>
        <name>sys_arch_timeouts</name>
        <param>
          <type>void</type>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="477" column="19" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="477" bodyend="481"/>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1a29a81985c051357162ad079023a076cd" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_init</definition>
        <argsstring>()</argsstring>
        <name>sys_init</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="32" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="32" bodyend="35"/>
        <references refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" compoundref="time_8c" startline="110" endline="118">gettimeofday</references>
        <referencedby refid="core_2init_8c_1a0c1a18439524d2f4a5e51d25c0ca2ce9" compoundref="core_2init_8c" startline="333" endline="381">lwip_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1gad4a51a28337f89d4b4806e6deb99798d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mbox_free</definition>
        <argsstring>(struct sys_mbox **mb)</argsstring>
        <name>sys_mbox_free</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Delete an mbox <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>mbox to delete </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="194" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="194" bodyend="213"/>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="sys__arch_8h_1a151f190d8a41cf6e2a02e0eec2b75355" compoundref="sys__arch_8h" startline="7">SYS_MBOX_NULL</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1ga26c015e64c859c9361a6f75c4e6fa829" 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 sys_mbox_new</definition>
        <argsstring>(struct sys_mbox **mb, int size)</argsstring>
        <name>sys_mbox_new</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <param>
          <type>int</type>
          <declname>size</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Create a new mbox of specified size <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>pointer to the mbox to create </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>size</parametername>
</parameternamelist>
<parameterdescription>
<para>(minimum) number of messages in this mbox </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if successful, another err_t otherwise </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="161" column="7" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="161" bodyend="192"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1ga8ff11ed9831af7ca486123f74d4064ac" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mbox_post</definition>
        <argsstring>(struct sys_mbox **mb, void *msg)</argsstring>
        <name>sys_mbox_post</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>msg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Post a message to an mbox - may not fail -&gt; blocks if full, only used from tasks not from ISR <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>mbox to posts the message </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>msg</parametername>
</parameternamelist>
<parameterdescription>
<para>message to post (ATTENTION: can be NULL) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="215" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="215" bodyend="249"/>
        <references refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" compoundref="sys__arch_8h" startline="23">sys_mbox::head</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1ga64ca1b1ef4c810f4d67595eca4fdfef0" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mbox_set_invalid</definition>
        <argsstring>(struct sys_mbox **mb)</argsstring>
        <name>sys_mbox_set_invalid</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Set an mbox invalid so that sys_mbox_valid returns 0 </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="375" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="375" bodyend="377"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1gacc06f47f34de04084e1d49788ce871b6" 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 sys_mbox_trypost</definition>
        <argsstring>(struct sys_mbox **mb, void *msg)</argsstring>
        <name>sys_mbox_trypost</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>msg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Try to post a message to an mbox - may fail if full or ISR <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mbox</parametername>
</parameternamelist>
<parameterdescription>
<para>mbox to posts the message </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>msg</parametername>
</parameternamelist>
<parameterdescription>
<para>message to post (ATTENTION: can be NULL) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="251" column="7" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="251" bodyend="285"/>
        <references refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" compoundref="sys__arch_8h" startline="23">sys_mbox::head</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_mbox_valid</definition>
        <argsstring>(struct sys_mbox **mb)</argsstring>
        <name>sys_mbox_valid</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> **</type>
          <declname>mb</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="367" column="5" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="367" bodyend="373"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__mutex_1ga16336ce68b741e98204102ca4bc84dd9" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mutex_free</definition>
        <argsstring>(sys_mutex_t *mutex)</argsstring>
        <name>sys_mutex_free</name>
        <param>
          <type><ref refid="sys__arch_8h_1a222e7d52225fc3453d7a2240b9209849" kindref="member">sys_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Delete a semaphore <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mutex</parametername>
</parameternamelist>
<parameterdescription>
<para>the mutex to delete </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="149" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="149" bodyend="151"/>
        <references refid="ubthread_8h_1a278f5d5b1e11b6668b75da6a285442e4" compoundref="ubthread_8c" startline="77" endline="81">ubthread_mutex_destroy</references>
        <references refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" compoundref="ubthread_8c" startline="43">mutex</references>
        <references refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" compoundref="ubthread_8h" startline="70">ubthread_mutex_list::mutex</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__mutex_1ga4d4eb9afe5965fa2661dd54ff55d616a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mutex_lock</definition>
        <argsstring>(sys_mutex_t *mutex)</argsstring>
        <name>sys_mutex_lock</name>
        <param>
          <type><ref refid="sys__arch_8h_1a222e7d52225fc3453d7a2240b9209849" kindref="member">sys_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Lock a mutex <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mutex</parametername>
</parameternamelist>
<parameterdescription>
<para>the mutex to lock </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="153" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="153" bodyend="155"/>
        <references refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" compoundref="ubthread_8c" startline="88" endline="107">ubthread_mutex_lock</references>
        <references refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" compoundref="ubthread_8c" startline="43">mutex</references>
        <references refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" compoundref="ubthread_8h" startline="70">ubthread_mutex_list::mutex</references>
        <referencedby refid="mem_8c_1a932aa40d85b14cb7331625e012d12335" compoundref="mem_8c" startline="603" endline="742">mem_malloc</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__sys__mutex_1ga38e7dae1fd88b338eb1cd97f110f3897" 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 sys_mutex_new</definition>
        <argsstring>(sys_mutex_t *mutex)</argsstring>
        <name>sys_mutex_new</name>
        <param>
          <type><ref refid="sys__arch_8h_1a222e7d52225fc3453d7a2240b9209849" kindref="member">sys_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Create a new mutex. Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mutex</parametername>
</parameternamelist>
<parameterdescription>
<para>pointer to the mutex to create </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if successful, another err_t otherwise </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="144" column="7" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="144" bodyend="147"/>
        <references refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855">ubthread_mutex_init</references>
        <references refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" compoundref="ubthread_8c" startline="43">mutex</references>
        <references refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" compoundref="ubthread_8h" startline="70">ubthread_mutex_list::mutex</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__mutex_1ga5568f68898fe9d5735f9ce2f665624fb" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_mutex_unlock</definition>
        <argsstring>(sys_mutex_t *mutex)</argsstring>
        <name>sys_mutex_unlock</name>
        <param>
          <type><ref refid="sys__arch_8h_1a222e7d52225fc3453d7a2240b9209849" kindref="member">sys_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Unlock a mutex <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>mutex</parametername>
</parameternamelist>
<parameterdescription>
<para>the mutex to unlock </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="157" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="157" bodyend="159"/>
        <references refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" compoundref="ubthread_8c" startline="109" endline="127">ubthread_mutex_unlock</references>
        <references refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" compoundref="ubthread_8c" startline="43">mutex</references>
        <references refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" compoundref="ubthread_8h" startline="70">ubthread_mutex_list::mutex</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t sys_now</definition>
        <argsstring>()</argsstring>
        <name>sys_now</name>
        <param>
          <type>void</type>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it. </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="497" column="10" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="497" bodyend="499"/>
        <references refid="sys__arch_8c_1aa40706a5e306545035127c0cf198cf49" compoundref="sys__arch_8c" startline="483" endline="495">sys_unix_now</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_sem_free</definition>
        <argsstring>(struct sys_sem **sem)</argsstring>
        <name>sys_sem_free</name>
        <param>
          <type><ref refid="sem_8h_1a900e36da93bb688c29fc8148f2f44e04" kindref="member">sys_sem_t</ref> **</type>
          <declname>sem</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Delete a semaphore <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>sem</parametername>
</parameternamelist>
<parameterdescription>
<para>semaphore to delete </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="75" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="75" bodyend="86"/>
        <references refid="sem_8h_1adcce987e1dbe6b3740a4b8f1a49c680f" compoundref="sem_8c" startline="87" endline="100">sem_destroy</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="sys__arch_8h_1ac66fcad3bfe79589054eb31765031544" compoundref="sys__arch_8h" startline="8">SYS_SEM_NULL</references>
        <referencedby refid="group__sys__misc_1ga6b8786f43e779953e8b74e983c88682e" compoundref="sys_8c" startline="93" endline="103">sys_msleep</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1ab86ebe077da1793a8737ae193c2adb35" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void sys_sem_free_internal</definition>
        <argsstring>(struct sys_sem *sem)</argsstring>
        <name>sys_sem_free_internal</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> *</type>
          <declname>sem</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="29" column="13" declfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" declline="29" declcolumn="13"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" 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 sys_sem_new</definition>
        <argsstring>(sys_sem_t **sem, uint8_t count)</argsstring>
        <name>sys_sem_new</name>
        <param>
          <type><ref refid="sem_8h_1a900e36da93bb688c29fc8148f2f44e04" kindref="member">sys_sem_t</ref> **</type>
          <declname>sem</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Create a new semaphore <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>sem</parametername>
</parameternamelist>
<parameterdescription>
<para>pointer to the semaphore to create </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>count</parametername>
</parameternamelist>
<parameterdescription>
<para>initial count of the semaphore </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if successful, another err_t otherwise </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="52" column="7" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="52" bodyend="72"/>
        <references refid="sem_8h_1a741be298cbcc3eab1747e8b9b239d5f0" compoundref="sem_8c" startline="56" endline="73">sem_init</references>
        <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references>
        <references refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="241" endline="331">kmalloc</references>
        <references refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" compoundref="sem_8h" startline="37">sys_sem::signaled</references>
        <references refid="ubthread_8h_1acbb7170a68758468ab5b02512a320112">ubthread_cond_init</references>
        <references refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" compoundref="sem_8h" startline="38">sys_sem::cond</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855">ubthread_mutex_init</references>
        <references refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" compoundref="sem_8h" startline="39">sys_sem::mutex</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
        <referencedby refid="tcpip_8c_1a3d42b0c46607f91aedcc7745ed466b08" compoundref="tcpip_8c" startline="356" endline="394">tcpip_api_call</referencedby>
        <referencedby refid="group__sys__misc_1ga6b8786f43e779953e8b74e983c88682e" compoundref="sys_8c" startline="93" endline="103">sys_msleep</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1ga6b618ddf0c8e73302f1dae7821661457" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_sem_set_invalid</definition>
        <argsstring>(struct sys_sem **s)</argsstring>
        <name>sys_sem_set_invalid</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> **</type>
          <declname>s</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Set a semaphore invalid so that sys_sem_valid returns 0 </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="140" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="140" bodyend="142"/>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_sem_signal</definition>
        <argsstring>(struct sys_sem **s)</argsstring>
        <name>sys_sem_signal</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> **</type>
          <declname>s</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Signals a semaphore <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>sem</parametername>
</parameternamelist>
<parameterdescription>
<para>the semaphore to signal </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="89" column="6" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="89" bodyend="103"/>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" compoundref="ubthread_8c" startline="88" endline="107">ubthread_mutex_lock</references>
        <references refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" compoundref="sem_8h" startline="39">sys_sem::mutex</references>
        <references refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" compoundref="sem_8h" startline="37">sys_sem::signaled</references>
        <references refid="ubthread_8h_1aeb2f756a095ecfddad31354f819623ee" compoundref="ubthread_8c" startline="164" endline="169">ubthread_cond_broadcast</references>
        <references refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" compoundref="sem_8h" startline="38">sys_sem::cond</references>
        <references refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" compoundref="ubthread_8c" startline="109" endline="127">ubthread_mutex_unlock</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__sem_1gac7ff314270976b80559d043f6098817b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_sem_valid</definition>
        <argsstring>(struct sys_sem **s)</argsstring>
        <name>sys_sem_valid</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> **</type>
          <declname>s</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Check if a semaphore is valid/allocated: return 1 for valid, 0 for invalid </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="132" column="5" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="132" bodyend="138"/>
        <referencedby refid="tcpip_8c_1a12bdf37eddcd72c4178e3ea7d370395d" compoundref="tcpip_8c" startline="322" endline="344">tcpip_send_msg_wait_sem</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1aa2dd3c49552bada777725bd4a3ee19a4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_sendto</definition>
        <argsstring>(struct thread *td, struct sys_sendto_args *args)</argsstring>
        <name>sys_sendto</name>
        <param>
          <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type>
          <declname>td</declname>
        </param>
        <param>
          <type>struct <ref refid="structsys__sendto__args" kindref="compound">sys_sendto_args</ref> *</type>
          <declname>args</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="540" column="5" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="540" bodyend="548"/>
        <references refid="structsys__sendto__args_1ab732d29637ff40328a2df62544d483d0" compoundref="sysproto__posix_8h" startline="703">sys_sendto_args::buf</references>
        <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references>
        <references refid="structsys__sendto__args_1ae4a3e262bcfe54357d6561277c7d042b" compoundref="sysproto__posix_8h" startline="709">sys_sendto_args::flags</references>
        <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references>
        <references refid="structsys__sendto__args_1a59447a72b4f723da2fc62d0c5277f37a" compoundref="sysproto__posix_8h" startline="706">sys_sendto_args::len</references>
        <references refid="structsys__sendto__args_1a0cdf2b658bc69bf5953307834bd24762" compoundref="sysproto__posix_8h" startline="700">sys_sendto_args::s</references>
        <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references>
        <references refid="structsys__sendto__args_1a49a036c43bd615d5538abf735d8e961b" compoundref="sysproto__posix_8h" startline="712">sys_sendto_args::to</references>
        <references refid="structsys__sendto__args_1a43184dc4152b51eff221e5bb127777ed" compoundref="sysproto__posix_8h" startline="715">sys_sendto_args::tolen</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1afab8740b07db1e3546145e3835182324" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_setsockopt</definition>
        <argsstring>(struct thread *td, struct sys_setsockopt_args *args)</argsstring>
        <name>sys_setsockopt</name>
        <param>
          <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type>
          <declname>td</declname>
        </param>
        <param>
          <type>struct <ref refid="structsys__setsockopt__args" kindref="compound">sys_setsockopt_args</ref> *</type>
          <declname>args</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="529" column="5" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="529" bodyend="538"/>
        <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references>
        <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references>
        <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references>
        <references refid="structsys__setsockopt__args_1a708c277b5a7a86b8a9f4b509143e4d29" compoundref="sysproto__posix_8h" startline="658">sys_setsockopt_args::level</references>
        <references refid="structsys__setsockopt__args_1ac6593d57df68514756da624e6837ad01" compoundref="sysproto__posix_8h" startline="661">sys_setsockopt_args::name</references>
        <references refid="structsys__setsockopt__args_1a9cd0e0210ae5f2e21df72ee285b139f9" compoundref="sysproto__posix_8h" startline="655">sys_setsockopt_args::s</references>
        <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references>
        <references refid="structsys__setsockopt__args_1ae8fd9d06ec522de42e76ab67b22401e7" compoundref="sysproto__posix_8h" startline="664">sys_setsockopt_args::val</references>
        <references refid="structsys__setsockopt__args_1a611cdad145a127b525a3f7078506058c" compoundref="sysproto__posix_8h" startline="667">sys_setsockopt_args::valsize</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1ad76124831716632ba4c77d30d15817de" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_socket</definition>
        <argsstring>(struct thread *td, struct sys_socket_args *args)</argsstring>
        <name>sys_socket</name>
        <param>
          <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type>
          <declname>td</declname>
        </param>
        <param>
          <type>struct <ref refid="structsys__socket__args" kindref="compound">sys_socket_args</ref> *</type>
          <declname>args</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="502" column="5" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="502" bodyend="527"/>
        <references refid="structsys__socket__args_1add6da33e33b8e25e144ee8b38e56fe7e" compoundref="sysproto__posix_8h" startline="643">sys_socket_args::domain</references>
        <references refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" compoundref="descrip_8c" startline="96" endline="123">falloc</references>
        <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references>
        <references refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" compoundref="descrip_8h" startline="72">file::fd_type</references>
        <references refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" compoundref="descrip_8c" startline="147" endline="160">fdestroy</references>
        <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references>
        <references refid="structsys__socket__args_1aaccf6efd6512d1cf88c9823c8e53e454" compoundref="sysproto__posix_8h" startline="649">sys_socket_args::protocol</references>
        <references refid="structfile_1aaad1c900a9ee26ad1aa91be70b6f98ec" compoundref="descrip_8h" startline="73">file::socket</references>
        <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references>
        <references refid="structsys__socket__args_1a3824ec8b40b6aa901143a2644846e2ab" compoundref="sysproto__posix_8h" startline="646">sys_socket_args::type</references>
      </memberdef>
      <memberdef kind="function" id="group__sys__misc_1ga0d596afdd8dbcfad320172d39b0f607a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="sys__arch_8h_1a2930394713e07b1b46b0b5396708d911" kindref="member">sys_thread_t</ref></type>
        <definition>sys_thread_t sys_thread_new</definition>
        <argsstring>(const char *name, void(*thread)(void *arg), void *arg, int stacksize, int prio)</argsstring>
        <name>sys_thread_new</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>name</declname>
        </param>
        <param>
          <type><ref refid="sys_8h_1ae30a77bf6bd69bfcc5f235eaad54f2b9" kindref="member">lwip_thread_fn</ref></type>
          <declname>thread</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>arg</declname>
        </param>
        <param>
          <type>int</type>
          <declname>stacksize</declname>
        </param>
        <param>
          <type>int</type>
          <declname>prio</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>The only thread function: Creates a new thread ATTENTION: although this function returns a value, it MUST NOT FAIL (ports have to assert this!) <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>name</parametername>
</parameternamelist>
<parameterdescription>
<para>human-readable name for the thread (used for debugging purposes) </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>thread</parametername>
</parameternamelist>
<parameterdescription>
<para>thread-function </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>arg</parametername>
</parameternamelist>
<parameterdescription>
<para>parameter passed to &apos;thread&apos; </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>stacksize</parametername>
</parameternamelist>
<parameterdescription>
<para>stack size in bytes for the new thread (may be ignored by ports) </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>prio</parametername>
</parameternamelist>
<parameterdescription>
<para>priority of the new thread (may be ignored by ports) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="379" column="14" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="379" bodyend="408"/>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="241" endline="331">kmalloc</references>
        <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references>
        <references refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" compoundref="armv6_2spinlock_8c" startline="55" endline="61">spinLock</references>
        <referencedby refid="net_2init_8c_1a22b2914249628f6cba7d4e1f138c969f" compoundref="net_2init_8c" startline="52" endline="70">net_init</referencedby>
        <referencedby refid="bot_8c_1ae5e17afd28772b096c68d413334b257a" compoundref="bot_8c" startline="83" endline="85">bot_init</referencedby>
        <referencedby refid="udpecho_8h_1ab288cc2f0b684d8cffe7f074724127e2" compoundref="udpecho_8c" startline="64" endline="66">udpecho_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1aa40706a5e306545035127c0cf198cf49" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>unsigned long</type>
        <definition>unsigned long sys_unix_now</definition>
        <argsstring>()</argsstring>
        <name>sys_unix_now</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" line="483" column="15" bodyfile="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c" bodystart="483" bodyend="495"/>
        <references refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" compoundref="time_8c" startline="110" endline="118">gettimeofday</references>
        <references refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" compoundref="__timeval_8h" startline="18">timeval::tv_sec</references>
        <referencedby refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" compoundref="sys__arch_8c" startline="497" endline="499">sys_now</referencedby>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;<ref refid="include_2sys_2types_8h" kindref="compound">sys/types.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sched_8h" kindref="compound">ubixos/sched.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="ubthread_8h" kindref="compound">ubixos/ubthread.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kpanic_8h" kindref="compound">ubixos/kpanic.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kprintf_8h" kindref="compound">lib/kprintf.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kmalloc_8h" kindref="compound">lib/kmalloc.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sysproto__posix_8h" kindref="compound">sys/sysproto_posix.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="descrip_8h" kindref="compound">sys/descrip.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="debug_8h" kindref="compound">net/debug.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="sys_8h" kindref="compound">net/sys.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sys__arch_8h" kindref="compound">net/arch/sys_arch.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="spinlock_8h" kindref="compound">ubixos/spinlock.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sem_8h" kindref="compound">ubixos/sem.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Get<sp/>Definitions<sp/>For<sp/>These<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="20" refid="sys__arch_8c_1a2047048fa208fc8af0415adbdd1a8058" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ERR_NOT_READY<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21" refid="sys__arch_8c_1a8accf4162b03c91a5f0966f31b965919" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ERR_TIMED_OUT<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="22" refid="sys__arch_8c_1ad6d23821ba98486c430e44681e2cb4c2" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>INFINITE_TIME<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimeval" kindref="compound">timeval</ref><sp/>starttime;</highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structspinLock" kindref="compound">spinLock</ref><sp/>netThreadSpinlock<sp/>=<sp/><ref refid="spinlock_8h_1a0fe85a4f3642683148b25916d6c5eafd" kindref="member">SPIN_LOCK_INITIALIZER</ref>;</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*threads<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>cond_wait(<ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref><sp/>*cond,<sp/><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>timeout);</highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>sys_sem_free_internal(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sem);</highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>sys_arch<sp/>layer<sp/>initializer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32" refid="sys__arch_8c_1a29a81985c051357162ad079023a076cd" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_1a29a81985c051357162ad079023a076cd" kindref="member">sys_init</ref>()<sp/>{</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimezone" kindref="compound">timezone</ref><sp/>tz;</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/><ref refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;starttime,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="35"><highlight class="normal">}</highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>_IGNORE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sys_sem_new_internal(<ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="39"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sem;</highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/>sem<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref>));</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sem<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/>sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>=<sp/>count;</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_1acbb7170a68758468ab5b02512a320112" kindref="member">ubthread_cond_init</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855" kindref="member">ubthread_mutex_init</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>sem;</highlight></codeline>
<codeline lineno="48"><highlight class="normal">}</highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Create<sp/>a<sp/>new<sp/>semaphore<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52" refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" kindref="member">sys_sem_new</ref>(<ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>**sem,<sp/><ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="sem_8h_1a741be298cbcc3eab1747e8b9b239d5f0" kindref="member">sem_init</ref>(sem,<sp/>count));</highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>__IGNORE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>*newSem<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*sem<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;UH<sp/>OH!&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/>newSem<sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref>));</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/>newSem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>=<sp/>count;</highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1acbb7170a68758468ab5b02512a320112" kindref="member">ubthread_cond_init</ref>(&amp;(newSem-&gt;<ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855" kindref="member">ubthread_mutex_init</ref>(&amp;(newSem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/>*sem<sp/>=<sp/>newSem;</highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><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="71"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal">}</highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Deallocate<sp/>semaphore<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75" refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" kindref="member">sys_sem_free</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>**sem)<sp/>{</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><ref refid="sem_8h_1adcce987e1dbe6b3740a4b8f1a49c680f" kindref="member">sem_destroy</ref>(sem);</highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>_IGNORE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sem<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*sem<sp/>!=<sp/><ref refid="sys__arch_8h_1ac66fcad3bfe79589054eb31765031544" kindref="member">SYS_SEM_NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/>sys_sem_free_internal(*sem);</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/>*sem<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal">}</highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Signal<sp/>semaphore<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="89" refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>**s)<sp/>{</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sem;</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>sem&quot;</highlight><highlight class="normal">,<sp/>(s<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*s<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/>sem<sp/>=<sp/>*s;</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" kindref="member">ubthread_mutex_lock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/>sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref>++;</highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>&gt;<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/>sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1aeb2f756a095ecfddad31354f819623ee" kindref="member">ubthread_cond_broadcast</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>));</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="103"><highlight class="normal">}</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
<codeline lineno="105" refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" refkind="member"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>**s,<sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>time_needed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sem;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>sem&quot;</highlight><highlight class="normal">,<sp/>(s<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*s<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/>sem<sp/>=<sp/>*s;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" kindref="member">ubthread_mutex_lock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>&lt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>time_needed<sp/>=<sp/>cond_wait(&amp;(sem-&gt;<ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/>&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/>timeout);</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(time_needed<sp/>==<sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>;</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/><sp/><sp/><sp/><sp/><sp/>ubthread_mutex_unlock(&amp;(sem-&gt;mutex));</highlight></codeline>
<codeline lineno="121"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>time_needed;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cond_wait(&amp;(sem-&gt;<ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/>&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/>0);</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/>sem-&gt;<ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref>--;</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>time_needed;</highlight></codeline>
<codeline lineno="130"><highlight class="normal">}</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132" refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" kindref="member">sys_sem_valid</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>**s)<sp/>{</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*sem<sp/>=<sp/>*s;</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sem<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="138"><highlight class="normal">}</highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight></codeline>
<codeline lineno="140" refid="group__sys__sem_1ga6b618ddf0c8e73302f1dae7821661457" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__sem_1ga6b618ddf0c8e73302f1dae7821661457" kindref="member">sys_sem_set_invalid</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>**s)<sp/>{</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/>*s<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="142"><highlight class="normal">}</highlight></codeline>
<codeline lineno="143"><highlight class="normal"></highlight></codeline>
<codeline lineno="144" refid="group__sys__mutex_1ga38e7dae1fd88b338eb1cd97f110f3897" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="group__sys__mutex_1ga38e7dae1fd88b338eb1cd97f110f3897" kindref="member">sys_mutex_new</ref>(<ref refid="structsys__mutex" kindref="compound">sys_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>)<sp/>{</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855" kindref="member">ubthread_mutex_init</ref>(&amp;(<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>-&gt;<ref refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" kindref="member">mutex</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="146"><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="147"><highlight class="normal">}</highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight></codeline>
<codeline lineno="149" refid="group__sys__mutex_1ga16336ce68b741e98204102ca4bc84dd9" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mutex_1ga16336ce68b741e98204102ca4bc84dd9" kindref="member">sys_mutex_free</ref>(<ref refid="structsys__mutex" kindref="compound">sys_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>)<sp/>{</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1a278f5d5b1e11b6668b75da6a285442e4" kindref="member">ubthread_mutex_destroy</ref>(&amp;(<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>-&gt;<ref refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="151"><highlight class="normal">}</highlight></codeline>
<codeline lineno="152"><highlight class="normal"></highlight></codeline>
<codeline lineno="153" refid="group__sys__mutex_1ga4d4eb9afe5965fa2661dd54ff55d616a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mutex_1ga4d4eb9afe5965fa2661dd54ff55d616a" kindref="member">sys_mutex_lock</ref>(<ref refid="structsys__mutex" kindref="compound">sys_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>)<sp/>{</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1aa13bf141cd3e9bf0921fbf61ffc637d8" kindref="member">ubthread_mutex_lock</ref>(&amp;(<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>-&gt;<ref refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="155"><highlight class="normal">}</highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight></codeline>
<codeline lineno="157" refid="group__sys__mutex_1ga5568f68898fe9d5735f9ce2f665624fb" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mutex_1ga5568f68898fe9d5735f9ce2f665624fb" kindref="member">sys_mutex_unlock</ref>(<ref refid="structsys__mutex" kindref="compound">sys_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>)<sp/>{</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1afea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>-&gt;<ref refid="structubthread__mutex__list_1a020fa0de30d24e5984a2715a8f3a3c9c" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="159"><highlight class="normal">}</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight></codeline>
<codeline lineno="161" refid="group__sys__mbox_1ga26c015e64c859c9361a6f75c4e6fa829" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="group__sys__mbox_1ga26c015e64c859c9361a6f75c4e6fa829" kindref="member">sys_mbox_new</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>size)<sp/>{</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(size);</highlight></codeline>
<codeline lineno="164"><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/>mbox<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref>));</highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="168"><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="169"><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1aff3a258c562ed6a62aba85bec6ac1c65" kindref="member">tail</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1ad6698db8cc389a910fd56d801c9e7887" kindref="member">wait_send</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//mbox-&gt;size<sp/>=<sp/>size;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="174"><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//Pass<sp/>By<sp/>Reference<sp/>It&apos;s<sp/>a<sp/>Pointer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//ubthread_mutex_init(&amp;mbox-&gt;lock,<sp/>NULL);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//Pass<sp/>By<sp/>Reference<sp/>It&apos;s<sp/>a<sp/>Pointer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" kindref="member">sys_sem_new</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>1);</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" kindref="member">sys_sem_new</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a2bd3eadfaa16d2237607107f2cfed0ee" kindref="member">empty</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" kindref="member">sys_sem_new</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1553f21c46b5160df7da394a8981a276" kindref="member">full</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//mbox-&gt;queue<sp/>=<sp/>kmalloc(sizeof(void<sp/>*)<sp/>*<sp/>size);//calloc(size,<sp/>sizeof(void<sp/>*));</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//if<sp/>(!mbox-&gt;queue)<sp/>{</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/><sp/>return<sp/>ERR_MEM;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//}</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/>*mb<sp/>=<sp/>mbox;</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><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="192"><highlight class="normal">}</highlight></codeline>
<codeline lineno="193"><highlight class="normal"></highlight></codeline>
<codeline lineno="194" refid="group__sys__mbox_1gad4a51a28337f89d4b4806e6deb99798d" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mbox_1gad4a51a28337f89d4b4806e6deb99798d" kindref="member">sys_mbox_free</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb)<sp/>{</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*mb<sp/>!=<sp/><ref refid="sys__arch_8h_1a151f190d8a41cf6e2a02e0eec2b75355" kindref="member">SYS_MBOX_NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="199"><highlight class="comment"><sp/><sp/><sp/><sp/>sys_sem_free_internal(mbox-&gt;full);</highlight></codeline>
<codeline lineno="200"><highlight class="comment"><sp/><sp/><sp/><sp/>sys_sem_free_internal(mbox-&gt;empty);</highlight></codeline>
<codeline lineno="201"><highlight class="comment"><sp/><sp/><sp/><sp/>sys_sem_free_internal(mbox-&gt;lock);</highlight></codeline>
<codeline lineno="202"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><ref refid="sem_8h_1adcce987e1dbe6b3740a4b8f1a49c680f" kindref="member">sem_destroy</ref>(mbox-&gt;<ref refid="structsys__mbox_1a1553f21c46b5160df7da394a8981a276" kindref="member">full</ref>);</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/><ref refid="sem_8h_1adcce987e1dbe6b3740a4b8f1a49c680f" kindref="member">sem_destroy</ref>(mbox-&gt;<ref refid="structsys__mbox_1a2bd3eadfaa16d2237607107f2cfed0ee" kindref="member">empty</ref>);</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><ref refid="sem_8h_1adcce987e1dbe6b3740a4b8f1a49c680f" kindref="member">sem_destroy</ref>(mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1a1553f21c46b5160df7da394a8981a276" kindref="member">full</ref><sp/>=<sp/>mbox-&gt;<ref refid="structsys__mbox_1a2bd3eadfaa16d2237607107f2cfed0ee" kindref="member">empty</ref><sp/>=<sp/>mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(mbox);</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/>*mb<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kfree(mbox-&gt;queue);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//mbox-&gt;queue<sp/>=<sp/>NULL;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal">}</highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="215" refid="group__sys__mbox_1ga8ff11ed9831af7ca486123f74d4064ac" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mbox_1ga8ff11ed9831af7ca486123f74d4064ac" kindref="member">sys_mbox_post</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*msg)<sp/>{</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>;</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox;</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>mbox&quot;</highlight><highlight class="normal">,<sp/>(mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/>mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="220"><highlight class="normal"></highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="222"><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_post:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)msg));</highlight></codeline>
<codeline lineno="224"><highlight class="normal"></highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((mbox-&gt;tail<sp/>+<sp/>1)<sp/>&gt;=<sp/>(mbox-&gt;head<sp/>+<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>))<sp/>{</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/>mbox-&gt;wait_send++;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;lock);</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;empty,<sp/>0);</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;lock,<sp/>0);</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/>mbox-&gt;wait_send--;</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="232"><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/>mbox-&gt;msgs[mbox-&gt;tail<sp/>%<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>]<sp/>=<sp/>msg;</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox-&gt;tail<sp/>==<sp/>mbox-&gt;head)<sp/>{</highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="241"><highlight class="normal"></highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/>mbox-&gt;tail++;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"></highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>)<sp/>{</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;full);</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;lock);</highlight></codeline>
<codeline lineno="249"><highlight class="normal">}</highlight></codeline>
<codeline lineno="250"><highlight class="normal"></highlight></codeline>
<codeline lineno="251" refid="group__sys__mbox_1gacc06f47f34de04084e1d49788ce871b6" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="group__sys__mbox_1gacc06f47f34de04084e1d49788ce871b6" kindref="member">sys_mbox_trypost</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*msg)<sp/>{</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>;</highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>mbox&quot;</highlight><highlight class="normal">,<sp/>(mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/>mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="256"><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="258"><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_trypost:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)msg));</highlight></codeline>
<codeline lineno="261"><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((mbox-&gt;tail<sp/>+<sp/>1)<sp/>&gt;=<sp/>(mbox-&gt;head<sp/>+<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>))<sp/>{</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;lock);</highlight></codeline>
<codeline lineno="264"><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="265"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="266"><highlight class="normal"></highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/>mbox-&gt;msgs[mbox-&gt;tail<sp/>%<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>]<sp/>=<sp/>msg;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox-&gt;tail<sp/>==<sp/>mbox-&gt;head)<sp/>{</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="275"><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/>mbox-&gt;tail++;</highlight></codeline>
<codeline lineno="277"><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>)<sp/>{</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;full);</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;lock);</highlight></codeline>
<codeline lineno="283"><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><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="285"><highlight class="normal">}</highlight></codeline>
<codeline lineno="286"><highlight class="normal"></highlight></codeline>
<codeline lineno="287" refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" refkind="member"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" kindref="member">sys_arch_mbox_fetch</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**msg,<sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>time_needed<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="290"><highlight class="normal"></highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>mbox&quot;</highlight><highlight class="normal">,<sp/>(mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/>mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>The<sp/>mutex<sp/>lock<sp/>is<sp/>quick<sp/>so<sp/>we<sp/>don&apos;t<sp/>bother<sp/>with<sp/>the<sp/>timeout</highlight></codeline>
<codeline lineno="295"><highlight class="comment"><sp/><sp/><sp/>stuff<sp/>here.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="297"><highlight class="normal"></highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(mbox-&gt;<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>==<sp/>mbox-&gt;<ref refid="structsys__mbox_1aff3a258c562ed6a62aba85bec6ac1c65" kindref="member">tail</ref>)<sp/>{</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>);</highlight></codeline>
<codeline lineno="300"><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>block<sp/>while<sp/>waiting<sp/>for<sp/>a<sp/>mail<sp/>to<sp/>arrive<sp/>in<sp/>the<sp/>mailbox.<sp/>We</highlight></codeline>
<codeline lineno="302"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>must<sp/>be<sp/>prepared<sp/>to<sp/>timeout.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>time_needed<sp/>=<sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1553f21c46b5160df7da394a8981a276" kindref="member">full</ref>,<sp/>timeout);</highlight></codeline>
<codeline lineno="305"><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(time_needed<sp/>==<sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>;</highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1553f21c46b5160df7da394a8981a276" kindref="member">full</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="313"><highlight class="normal"></highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="316"><highlight class="normal"></highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(msg<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_fetch:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox,<sp/>*msg));</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/>*msg<sp/>=<sp/>mbox-&gt;msgs[mbox-&gt;head<sp/>%<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>];</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_fetch:<sp/>mbox<sp/>%p,<sp/>null<sp/>msg\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox));</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="324"><highlight class="normal"></highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>++;</highlight></codeline>
<codeline lineno="326"><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox-&gt;<ref refid="structsys__mbox_1ad6698db8cc389a910fd56d801c9e7887" kindref="member">wait_send</ref>)<sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a2bd3eadfaa16d2237607107f2cfed0ee" kindref="member">empty</ref>);</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="330"><highlight class="normal"></highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>);</highlight></codeline>
<codeline lineno="332"><highlight class="normal"></highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>time_needed;</highlight></codeline>
<codeline lineno="334"><highlight class="normal">}</highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight></codeline>
<codeline lineno="336" refid="group__sys__mbox_1ga3e0e0f02be2f670ebfb093a21f7dcdb8" refkind="member"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="group__sys__mbox_1ga3e0e0f02be2f670ebfb093a21f7dcdb8" kindref="member">sys_arch_mbox_tryfetch</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**msg)<sp/>{</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox;</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>mbox&quot;</highlight><highlight class="normal">,<sp/>(mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(*mb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/>mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="340"><highlight class="normal"></highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1ga28aa725e8a36dd0cfde89875af4f3ec9" kindref="member">sys_arch_sem_wait</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="342"><highlight class="normal"></highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox-&gt;<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref><sp/>==<sp/>mbox-&gt;<ref refid="structsys__mbox_1aff3a258c562ed6a62aba85bec6ac1c65" kindref="member">tail</ref>)<sp/>{</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>);</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1ab0571e67edca0132b144106e9b319ef9" kindref="member">SYS_MBOX_EMPTY</ref>;</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="347"><highlight class="normal"></highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(msg<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_tryfetch:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox,<sp/>*msg));</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/>*msg<sp/>=<sp/>mbox-&gt;msgs[mbox-&gt;head<sp/>%<sp/><ref refid="sys__arch_8h_1ab6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>];</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2960ae20008f05da8cc0714f36365642" kindref="member">SYS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sys_mbox_tryfetch:<sp/>mbox<sp/>%p,<sp/>null<sp/>msg\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)mbox));</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="355"><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/>mbox-&gt;<ref refid="structsys__mbox_1a084e62236b143164e74e37d60ecba19b" kindref="member">head</ref>++;</highlight></codeline>
<codeline lineno="357"><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox-&gt;<ref refid="structsys__mbox_1ad6698db8cc389a910fd56d801c9e7887" kindref="member">wait_send</ref>)<sp/>{</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a2bd3eadfaa16d2237607107f2cfed0ee" kindref="member">empty</ref>);</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1gaff1dd2af219b75ae812e0b1660bd7455" kindref="member">sys_sem_signal</ref>(&amp;mbox-&gt;<ref refid="structsys__mbox_1a1b56bec7f803273a160fd1812ef9a78d" kindref="member">lock</ref>);</highlight></codeline>
<codeline lineno="363"><highlight class="normal"></highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="365"><highlight class="normal">}</highlight></codeline>
<codeline lineno="366"><highlight class="normal"></highlight></codeline>
<codeline lineno="367" refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb)<sp/>{</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*mbox<sp/>=<sp/>*mb;</highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mbox<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(1);</highlight></codeline>
<codeline lineno="373"><highlight class="normal">}</highlight></codeline>
<codeline lineno="374"><highlight class="normal"></highlight></codeline>
<codeline lineno="375" refid="group__sys__mbox_1ga64ca1b1ef4c810f4d67595eca4fdfef0" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="group__sys__mbox_1ga64ca1b1ef4c810f4d67595eca4fdfef0" kindref="member">sys_mbox_set_invalid</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>**mb)<sp/>{</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/>*mb<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="377"><highlight class="normal">}</highlight></codeline>
<codeline lineno="378"><highlight class="normal"></highlight></codeline>
<codeline lineno="379" refid="group__sys__misc_1ga0d596afdd8dbcfad320172d39b0f607a" refkind="member"><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread_t</ref><sp/><ref refid="group__sys__misc_1ga0d596afdd8dbcfad320172d39b0f607a" kindref="member">sys_thread_new</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>(*<ref refid="structthread" kindref="compound">thread</ref>)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg),<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>stacksize,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>prio)<sp/>{</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//void<sp/>sys_thread_new(void<sp/>(*function)(void),<sp/>void<sp/>*arg)<sp/>{</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*new_thread<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//struct<sp/>thread_start_param<sp/>*thread_param;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/>prio<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;Non-positive<sp/>prio&quot;</highlight><highlight class="normal">,<sp/>prio<sp/>&gt;<sp/>0);</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;Prio<sp/>is<sp/>too<sp/>big&quot;</highlight><highlight class="normal">,<sp/>prio<sp/>&lt;<sp/>20);</highlight></codeline>
<codeline lineno="386"><highlight class="normal"></highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/>new_thread<sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__thread" kindref="compound">sys_thread</ref>));</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(new_thread,<sp/>0x0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__thread" kindref="compound">sys_thread</ref>));</highlight></codeline>
<codeline lineno="389"><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;netThreadSpinlock);</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/>new_thread-&gt;<ref refid="structsys__thread_1a30bbf3f21718b4c9579777d2ba4d6528" kindref="member">next</ref><sp/>=<sp/>threads;</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/>new_thread-&gt;<ref refid="structsys__thread_1abf0a0f75b1958421416c879d8011413b" kindref="member">timeouts</ref>.<ref refid="structsys__timeouts_1a80922134cf5f7db06829b6ee49b4954c" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/>new_thread-&gt;<ref refid="structsys__thread_1a109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/>threads<sp/>=<sp/>new_thread;</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;netThreadSpinlock);</highlight></codeline>
<codeline lineno="396"><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="398"><highlight class="comment"><sp/><sp/><sp/>thread_param<sp/>=<sp/>kmalloc(sizeof(struct<sp/>thread_start_param));</highlight></codeline>
<codeline lineno="399"><highlight class="comment"></highlight></codeline>
<codeline lineno="400"><highlight class="comment"><sp/><sp/><sp/>thread_param-&gt;function<sp/>=<sp/>function;</highlight></codeline>
<codeline lineno="401"><highlight class="comment"><sp/><sp/><sp/>thread_param-&gt;arg<sp/>=<sp/>arg;</highlight></codeline>
<codeline lineno="402"><highlight class="comment"><sp/><sp/><sp/>thread_param-&gt;thread<sp/>=<sp/>thread;</highlight></codeline>
<codeline lineno="403"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ubthread_8h_1a268790b10ae29b2a8ca3ccea107bfc55" kindref="member">ubthread_create</ref>(&amp;new_thread-&gt;<ref refid="structsys__thread_1a109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref>,<sp/>0x0,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>(<ref refid="structthread" kindref="compound">thread</ref>),<sp/>arg)<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;sys_thread_new:<sp/>ubthread_create&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(new_thread);</highlight></codeline>
<codeline lineno="408"><highlight class="normal">}</highlight></codeline>
<codeline lineno="409"><highlight class="normal"></highlight></codeline>
<codeline lineno="410"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>OLD<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="412" refid="structthread__start__param" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structthread__start__param" kindref="compound">thread_start_param</ref><sp/>{</highlight></codeline>
<codeline lineno="413" refid="structthread__start__param_1a6cf526706b3be43bb00e750118687148" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*<ref refid="structthread__start__param_1a6cf526706b3be43bb00e750118687148" kindref="member">thread</ref>;</highlight></codeline>
<codeline lineno="414" refid="structthread__start__param_1a3f2fa524803bce0794c3323a02876925" refkind="member"><highlight class="normal"><sp/><sp/>void<sp/>(*</highlight><highlight class="keyword">function</highlight><highlight class="normal">)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*);</highlight></codeline>
<codeline lineno="415" refid="structthread__start__param_1a371e37a29e019c871fda24c2118c2896" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structthread__start__param_1a371e37a29e019c871fda24c2118c2896" kindref="member">arg</ref>;</highlight></codeline>
<codeline lineno="416"><highlight class="normal">};</highlight></codeline>
<codeline lineno="417"><highlight class="normal"></highlight></codeline>
<codeline lineno="418"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>cond_wait(<ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref><sp/>*cond,<sp/><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref><sp/>*<ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>tdiff;</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>sec,<sp/>usec;</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimeval" kindref="compound">timeval</ref><sp/>rtime1,<sp/>rtime2;</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimespec" kindref="compound">timespec</ref><sp/>ts;</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimezone" kindref="compound">timezone</ref><sp/>tz;</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>retval;</highlight></codeline>
<codeline lineno="425"><highlight class="normal"></highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>a<sp/>timestamp<sp/>and<sp/>add<sp/>the<sp/>timeout<sp/>value.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;rtime1,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/>sec<sp/>=<sp/>rtime1.<ref refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" kindref="member">tv_sec</ref>;</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>=<sp/>rtime1.<ref refid="structtimeval_1a810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>;</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>+=<sp/>timeout<sp/>%<sp/>1000<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/>sec<sp/>+=<sp/>(int)<sp/>(timeout<sp/>/<sp/>1000)<sp/>+<sp/>(int)<sp/>(usec<sp/>/<sp/>1000000);</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>=<sp/>usec<sp/>%<sp/>1000000;</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/>ts.<ref refid="structtimespec_1ae3c7510dafa8cbcaede866ed13c99683" kindref="member">tv_nsec</ref><sp/>=<sp/>usec<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/>ts.<ref refid="structtimespec_1afc3302668d7cb5952f590da69fdd4955" kindref="member">tv_sec</ref><sp/>=<sp/>sec;</highlight></codeline>
<codeline lineno="436"><highlight class="normal"></highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/>retval<sp/>=<sp/><ref refid="ubthread_8h_1a996be9a927447a62f7168a082a046c54" kindref="member">ubthread_cond_timedwait</ref>(cond,<sp/><ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/>&amp;ts);</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(retval<sp/>==<sp/><ref refid="sys_2errno_8h_1a597718e59a8fc9c4d4ab63f5a34e28b1" kindref="member">ETIMEDOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Calculate<sp/>for<sp/>how<sp/>long<sp/>we<sp/>waited<sp/>for<sp/>the<sp/>cond.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;rtime2,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tdiff<sp/>=<sp/>(rtime2.<ref refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" kindref="member">tv_sec</ref><sp/>-<sp/>rtime1.<ref refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" kindref="member">tv_sec</ref>)<sp/>*<sp/>1000<sp/>+<sp/>(rtime2.<ref refid="structtimeval_1a810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref><sp/>-<sp/>rtime1.<ref refid="structtimeval_1a810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>)<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tdiff<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tdiff;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_1a30eb7c156c2422801ddb86326dbc3d81" kindref="member">ubthread_cond_wait</ref>(cond,<sp/><ref refid="ubthread_8c_1a18b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="455"><highlight class="normal">}</highlight></codeline>
<codeline lineno="456"><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*current_thread(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*st;</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*pt;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/>pt<sp/>=<sp/><ref refid="ubthread_8h_1a4bbec629fa7ca82f6243cb02b014d1d5" kindref="member">ubthread_self</ref>();</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;netThreadSpinlock);</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(st<sp/>=<sp/>threads;<sp/>st<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>st<sp/>=<sp/>st-&gt;<ref refid="structsys__thread_1a30bbf3f21718b4c9579777d2ba4d6528" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(st-&gt;<ref refid="structsys__thread_1a109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref><sp/>==<sp/>pt)<sp/>{</highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;netThreadSpinlock);</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>st;</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;netThreadSpinlock);</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;sys:<sp/>current_thread:<sp/>could<sp/>not<sp/>find<sp/>current<sp/>thread!\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;This<sp/>is<sp/>due<sp/>to<sp/>a<sp/>race<sp/>condition<sp/>in<sp/>the<sp/>LinuxThreads\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;ubthreads<sp/>implementation.<sp/>Start<sp/>the<sp/>program<sp/>again.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="472"><highlight class="normal"></highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;ABORT&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0x0);</highlight></codeline>
<codeline lineno="475"><highlight class="normal">}</highlight></codeline>
<codeline lineno="476"><highlight class="normal"></highlight></codeline>
<codeline lineno="477" refid="sys__arch_8c_1a2ffdebd63f7a80c0233aa7460a816dff" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__timeouts" kindref="compound">sys_timeouts</ref><sp/>*<ref refid="sys__arch_8c_1a2ffdebd63f7a80c0233aa7460a816dff" kindref="member">sys_arch_timeouts</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>*<ref refid="structthread" kindref="compound">thread</ref>;</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>=<sp/>current_thread();</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(&amp;<ref refid="structthread" kindref="compound">thread</ref>-&gt;timeouts);</highlight></codeline>
<codeline lineno="481"><highlight class="normal">}</highlight></codeline>
<codeline lineno="482"><highlight class="normal"></highlight></codeline>
<codeline lineno="483" refid="sys__arch_8c_1aa40706a5e306545035127c0cf198cf49" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_1aa40706a5e306545035127c0cf198cf49" kindref="member">sys_unix_now</ref>()<sp/>{</highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimeval" kindref="compound">timeval</ref><sp/>tv;</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structtimezone" kindref="compound">timezone</ref><sp/>tz;</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>sec,<sp/>usec;</highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>msec;</highlight></codeline>
<codeline lineno="488"><highlight class="normal"></highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><ref refid="time_8h_1adf30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;tv,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="490"><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/>sec<sp/>=<sp/>tv.<ref refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" kindref="member">tv_sec</ref><sp/>-<sp/>starttime.<ref refid="structtimeval_1aef6ddab1064c430758f9f913b7e4a21e" kindref="member">tv_sec</ref>;</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/>usec<sp/>=<sp/>tv.<ref refid="structtimeval_1a810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref><sp/>-<sp/>starttime.<ref refid="structtimeval_1a810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/>msec<sp/>=<sp/>sec<sp/>*<sp/>1000<sp/>+<sp/>usec<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>msec;</highlight></codeline>
<codeline lineno="495"><highlight class="normal">}</highlight></codeline>
<codeline lineno="496"><highlight class="normal"></highlight></codeline>
<codeline lineno="497" refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" refkind="member"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" kindref="member">sys_now</ref>()<sp/>{</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="sys__arch_8c_1aa40706a5e306545035127c0cf198cf49" kindref="member">sys_unix_now</ref>());</highlight></codeline>
<codeline lineno="499"><highlight class="normal">}</highlight></codeline>
<codeline lineno="500"><highlight class="normal"></highlight></codeline>
<codeline lineno="501"><highlight class="normal"></highlight></codeline>
<codeline lineno="502" refid="sys__arch_8c_1ad76124831716632ba4c77d30d15817de" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_1ad76124831716632ba4c77d30d15817de" kindref="member">sys_socket</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__socket__args" kindref="compound">sys_socket_args</ref><sp/>*args)<sp/>{</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>error<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fd<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*nfp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"></highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/>error<sp/>=<sp/><ref refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" kindref="member">falloc</ref>(td,<sp/>&amp;nfp,<sp/>&amp;<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline>
<codeline lineno="508"><highlight class="normal"></highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(error)</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline>
<codeline lineno="511"><highlight class="normal"></highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/>nfp-&gt;<ref refid="structfile_1aaad1c900a9ee26ad1aa91be70b6f98ec" kindref="member">socket</ref><sp/>=<sp/>lwip_socket(args-&gt;<ref refid="structsys__socket__args_1add6da33e33b8e25e144ee8b38e56fe7e" kindref="member">domain</ref>,<sp/>args-&gt;<ref refid="structsys__socket__args_1a3824ec8b40b6aa901143a2644846e2ab" kindref="member">type</ref>,<sp/>args-&gt;<ref refid="structsys__socket__args_1aaccf6efd6512d1cf88c9823c8e53e454" kindref="member">protocol</ref>);</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/>nfp-&gt;<ref refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" kindref="member">fd_type</ref><sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;socket(%i:%i):<sp/>0x%X:0x%X:0x%X&quot;</highlight><highlight class="normal">,<sp/>nfp-&gt;<ref refid="structfile_1aaad1c900a9ee26ad1aa91be70b6f98ec" kindref="member">socket</ref>,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>args-&gt;<ref refid="structsys__socket__args_1add6da33e33b8e25e144ee8b38e56fe7e" kindref="member">domain</ref>,<sp/>args-&gt;<ref refid="structsys__socket__args_1a3824ec8b40b6aa901143a2644846e2ab" kindref="member">type</ref>,<sp/>args-&gt;<ref refid="structsys__socket__args_1aaccf6efd6512d1cf88c9823c8e53e454" kindref="member">protocol</ref>);</highlight></codeline>
<codeline lineno="515"><highlight class="normal"></highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nfp-&gt;<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>==<sp/>0x0<sp/><sp/>&amp;&amp;<sp/>nfp-&gt;<ref refid="structfile_1aaad1c900a9ee26ad1aa91be70b6f98ec" kindref="member">socket</ref>)<sp/>{</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(td,<sp/>nfp,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/>error<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>;</highlight><highlight class="comment">//nfp-&gt;fd;<sp/>//MrOlsen<sp/>2018index;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="525"><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline>
<codeline lineno="527"><highlight class="normal">}</highlight></codeline>
<codeline lineno="528"><highlight class="normal"></highlight></codeline>
<codeline lineno="529" refid="sys__arch_8c_1afab8740b07db1e3546145e3835182324" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_1afab8740b07db1e3546145e3835182324" kindref="member">sys_setsockopt</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__setsockopt__args" kindref="compound">sys_setsockopt_args</ref><sp/>*args)<sp/>{</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&amp;<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1a9cd0e0210ae5f2e21df72ee285b139f9" kindref="member">s</ref>);</highlight></codeline>
<codeline lineno="532"><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>lwip_setsockopt(<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>-&gt;socket,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1a708c277b5a7a86b8a9f4b509143e4d29" kindref="member">level</ref>,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1ac6593d57df68514756da624e6837ad01" kindref="member">name</ref>,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1ae8fd9d06ec522de42e76ab67b22401e7" kindref="member">val</ref>,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1a611cdad145a127b525a3f7078506058c" kindref="member">valsize</ref>);</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;SSO:<sp/>%i:%i:%i&quot;</highlight><highlight class="normal">,<sp/>args-&gt;<ref refid="structsys__setsockopt__args_1a9cd0e0210ae5f2e21df72ee285b139f9" kindref="member">s</ref>,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>-&gt;socket,<sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]);</highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="536"><highlight class="normal"></highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline>
<codeline lineno="538"><highlight class="normal">}</highlight></codeline>
<codeline lineno="539"><highlight class="normal"></highlight></codeline>
<codeline lineno="540" refid="sys__arch_8c_1aa2dd3c49552bada777725bd4a3ee19a4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_1aa2dd3c49552bada777725bd4a3ee19a4" kindref="member">sys_sendto</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__sendto__args" kindref="compound">sys_sendto_args</ref><sp/>*args)<sp/>{</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&amp;<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>args-&gt;<ref refid="structsys__sendto__args_1a0cdf2b658bc69bf5953307834bd24762" kindref="member">s</ref>);</highlight></codeline>
<codeline lineno="543"><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/>lwip_sendto(<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>-&gt;socket,<sp/>args-&gt;<ref refid="structsys__sendto__args_1ab732d29637ff40328a2df62544d483d0" kindref="member">buf</ref>,<sp/>args-&gt;<ref refid="structsys__sendto__args_1a59447a72b4f723da2fc62d0c5277f37a" kindref="member">len</ref>,<sp/>args-&gt;<ref refid="structsys__sendto__args_1ae4a3e262bcfe54357d6561277c7d042b" kindref="member">flags</ref>,<sp/>args-&gt;<ref refid="structsys__sendto__args_1a49a036c43bd615d5538abf735d8e961b" kindref="member">to</ref>,<sp/>args-&gt;<ref refid="structsys__sendto__args_1a43184dc4152b51eff221e5bb127777ed" kindref="member">tolen</ref>);</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="548"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/net/sys_arch.c"/>
  </compounddef>
</doxygen>
