<?xml version='1.0' encoding='iso-8859-1' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.4.7">
  <compounddef id="sys__arch_8c" kind="file">
    <compoundname>sys_arch.c</compoundname>
    <includes refid="types_8h" local="no">ubixos/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="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="spinlock_8h" local="no">ubixos/spinlock.h</includes>
    <incdepgraph>
      <node id="4073">
        <label>sys/thread.h</label>
        <link refid="thread_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4078">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="4087">
        <label>net/stats.h</label>
        <link refid="stats_8h"/>
        <childnode refid="4085" relation="include">
        </childnode>
        <childnode refid="4083" relation="include">
        </childnode>
        <childnode refid="4088" relation="include">
        </childnode>
      </node>
      <node id="4064">
        <label>ubixos/sched.h</label>
        <link refid="sched_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4065" relation="include">
        </childnode>
        <childnode refid="4066" relation="include">
        </childnode>
        <childnode refid="4067" relation="include">
        </childnode>
        <childnode refid="4074" relation="include">
        </childnode>
        <childnode refid="4073" relation="include">
        </childnode>
      </node>
      <node id="4089">
        <label>ubixos/spinlock.h</label>
        <link refid="spinlock_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4061">
        <label>src/sys/net/net/sys_arch.c</label>
        <link refid="sys_arch.c"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4064" relation="include">
        </childnode>
        <childnode refid="4075" relation="include">
        </childnode>
        <childnode refid="4078" relation="include">
        </childnode>
        <childnode refid="4079" relation="include">
        </childnode>
        <childnode refid="4080" relation="include">
        </childnode>
        <childnode refid="4081" relation="include">
        </childnode>
        <childnode refid="4082" relation="include">
        </childnode>
        <childnode refid="4085" relation="include">
        </childnode>
        <childnode refid="4087" relation="include">
        </childnode>
        <childnode refid="4089" relation="include">
        </childnode>
      </node>
      <node id="4084">
        <label>arch/sys_arch.h</label>
        <link refid="sys__arch_8h"/>
      </node>
      <node id="4062">
        <label>ubixos/types.h</label>
        <link refid="types_8h"/>
        <childnode refid="4063" relation="include">
        </childnode>
      </node>
      <node id="4063">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="4076">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4077" relation="include">
        </childnode>
      </node>
      <node id="4067">
        <label>vfs/file.h</label>
        <link refid="file_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4068" relation="include">
        </childnode>
        <childnode refid="4069" relation="include">
        </childnode>
      </node>
      <node id="4074">
        <label>sys/tss.h</label>
        <link refid="tss_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4080">
        <label>lib/kmalloc.h</label>
        <link refid="kmalloc_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4086">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="4088">
        <label>net/memp.h</label>
        <link refid="memp_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4081" relation="include">
        </childnode>
        <childnode refid="4083" relation="include">
        </childnode>
        <childnode refid="4086" relation="include">
        </childnode>
      </node>
      <node id="4070">
        <label>vfs/vfs.h</label>
        <link refid="vfs_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4067" relation="include">
        </childnode>
        <childnode refid="4069" relation="include">
        </childnode>
        <childnode refid="4071" relation="include">
        </childnode>
        <childnode refid="4073" relation="include">
        </childnode>
      </node>
      <node id="4069">
        <label>vfs/mount.h</label>
        <link refid="mount_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4070" relation="include">
        </childnode>
      </node>
      <node id="4079">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4075">
        <label>ubixos/ubthread.h</label>
        <link refid="ubthread_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
        <childnode refid="4064" relation="include">
        </childnode>
        <childnode refid="4076" relation="include">
        </childnode>
      </node>
      <node id="4068">
        <label>ubixfs/dirCache.h</label>
        <link refid="dirCache_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4085">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="4086" relation="include">
        </childnode>
      </node>
      <node id="4071">
        <label>sys/sysproto.h</label>
        <link refid="sysproto_8h"/>
        <childnode refid="4072" relation="include">
        </childnode>
        <childnode refid="4073" relation="include">
        </childnode>
      </node>
      <node id="4065">
        <label>ubixos/elf.h</label>
        <link refid="elf_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4072">
        <label>sys/signal.h</label>
        <link refid="signal_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4082">
        <label>net/sys.h</label>
        <link refid="sys_8h"/>
        <childnode refid="4083" relation="include">
        </childnode>
        <childnode refid="4084" relation="include">
        </childnode>
      </node>
      <node id="4066">
        <label>ubixos/tty.h</label>
        <link refid="tty_8h"/>
        <childnode refid="4062" relation="include">
        </childnode>
      </node>
      <node id="4077">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="4081">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
      </node>
      <node id="4083">
        <label>arch/cc.h</label>
        <link refid="cc_8h"/>
      </node>
    </incdepgraph>
    <innerclass refid="structsys__mbox" prot="public">sys_mbox</innerclass>
    <innerclass refid="structsys__mbox__msg" prot="public">sys_mbox_msg</innerclass>
    <innerclass refid="structsys__sem" prot="public">sys_sem</innerclass>
    <innerclass refid="structsys__thread" prot="public">sys_thread</innerclass>
    <innerclass refid="structthread__start__param" prot="public">thread_start_param</innerclass>
      <sectiondef kind="define">
      <memberdef kind="define" id="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" prot="public" static="no">
        <name>SYS_MBOX_SIZE</name>
        <initializer>100</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="106" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="106" bodyend="-1"/>
        <referencedby refid="sys__arch_8c_1d3bc5455ca12b164bfc78974ff0c1e3c" compoundref="sys__arch_8c" startline="254" endline="293">sys_arch_mbox_fetch</referencedby>
        <referencedby refid="sys__arch_8c_11e7a0edf077b67162d80fefffc8805fb" compoundref="sys__arch_8c" startline="227" endline="252">sys_mbox_post</referencedby>
      </memberdef>
      <memberdef kind="define" id="sys__arch_8c_155b0bf94baa06c302a48157cd42cd676" prot="public" static="no">
        <name>UMAX</name>
        <param><defname>a</defname></param>
        <param><defname>b</defname></param>
        <initializer>((a) &gt; (b) ? (a) : (b))</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="96" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="96" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
        <definition>static uInt16 cond_wait</definition>
        <argsstring>(ubthread_cond_t *cond, ubthread_mutex_t *mutex, uInt16 timeout)</argsstring>
        <name>cond_wait</name>
        <param>
          <type><ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref> *</type>
          <declname>cond</declname>
        </param>
        <param>
          <type><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref> *</type>
          <declname>mutex</declname>
        </param>
        <param>
          <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="133" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="311" bodyend="349"/>
        <references refid="ubthread_8h_1597718e59a8fc9c4d4ab63f5a34e28b1" compoundref="ubthread_8h" startline="37">ETIMEDOUT</references>
        <references refid="time_8h_1df30830f5265e55035171c301eb9c3fb" compoundref="time_8c" startline="110" endline="115">gettimeofday</references>
        <references refid="ubthread_8c_118b6be9ca0cec4b0643171232d6f10de" compoundref="ubthread_8c" startline="42">mutex</references>
        <references refid="structtimespec_1e3c7510dafa8cbcaede866ed13c99683" compoundref="time_8h" startline="52">timespec::tv_nsec</references>
        <references refid="structtimespec_1fc3302668d7cb5952f590da69fdd4955" compoundref="time_8h" startline="51">timespec::tv_sec</references>
        <references refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" compoundref="time_8h" startline="73">timeval::tv_sec</references>
        <references refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" compoundref="time_8h" startline="74">timeval::tv_usec</references>
        <references refid="ubthread_8h_1996be9a927447a62f7168a082a046c54" compoundref="ubthread_8c" startline="105" endline="115">ubthread_cond_timedwait</references>
        <references refid="ubthread_8h_130eb7c156c2422801ddb86326dbc3d81" compoundref="ubthread_8c" startline="117" endline="123">ubthread_cond_wait</references>
        <referencedby refid="sys__arch_8c_1af7b79a80d625789c95cb20b565424fd" compoundref="sys__arch_8c" startline="351" endline="368">sys_arch_sem_wait</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" 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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="135" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="135" bodyend="153"/>
        <references refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" compoundref="sys__arch_8c" startline="99">netThreadSpinlock</references>
        <references refid="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" compoundref="sys__arch_8c" startline="122">sys_thread::next</references>
        <references refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="def_8h" startline="41">NULL</references>
        <references refid="spinlock_8h_12cd9a4502680fb8e7f0fe6b029e558b1" compoundref="spinlock_8c" startline="56" endline="62">spinLock</references>
        <references refid="spinlock_8h_1dd996cbbb3b9826dd9c8cf02b66a4c65" compoundref="spinlock_8c" startline="37" endline="46">spinUnlock</references>
        <references refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" compoundref="sys__arch_8c" startline="98">threads</references>
        <references refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" compoundref="sys__arch_8c" startline="124">sys_thread::ubthread</references>
        <references refid="ubthread_8h_172a362bc8127b8d63e1107062638664d" compoundref="ubthread_8c" startline="44" endline="46">ubthread_self</references>
        <referencedby refid="sys__arch_8c_12ffdebd63f7a80c0233aa7460a816dff" compoundref="sys__arch_8c" startline="409" endline="413">sys_arch_timeouts</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1d3bc5455ca12b164bfc78974ff0c1e3c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
        <definition>uInt16 sys_arch_mbox_fetch</definition>
        <argsstring>(struct sys_mbox *mbox, void **msg, uInt16 timeout)</argsstring>
        <name>sys_arch_mbox_fetch</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> *</type>
          <declname>mbox</declname>
        </param>
        <param>
          <type>void **</type>
          <declname>msg</declname>
        </param>
        <param>
          <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="254" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="254" bodyend="293"/>
        <references refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" compoundref="sys__arch_8c" startline="109">sys_mbox::first</references>
        <references refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" compoundref="sys__arch_8c" startline="109">sys_mbox::last</references>
        <references refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" compoundref="sys__arch_8c" startline="111">sys_mbox::mail</references>
        <references refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" compoundref="tcpip_8c" startline="56">mbox</references>
        <references refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" compoundref="sys__arch_8c" startline="110">sys_mbox::msgs</references>
        <references refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" compoundref="sys__arch_8c" startline="112">sys_mbox::mutex</references>
        <references refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="def_8h" startline="41">NULL</references>
        <references refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937">sys_arch_sem_wait</references>
        <references refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" compoundref="sys__arch_8c" startline="106">SYS_MBOX_SIZE</references>
        <references refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa">sys_sem_signal</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1af7b79a80d625789c95cb20b565424fd" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
        <definition>uInt16 sys_arch_sem_wait</definition>
        <argsstring>(struct sys_sem *sem, uInt16 timeout)</argsstring>
        <name>sys_arch_sem_wait</name>
        <param>
          <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> *</type>
          <declname>sem</declname>
        </param>
        <param>
          <type><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref></type>
          <declname>timeout</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="351" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="351" bodyend="368"/>
        <references refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" compoundref="sys__arch_8c" startline="116">sys_sem::c</references>
        <references refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" compoundref="sys__arch_8c" startline="117">sys_sem::cond</references>
        <references refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" compoundref="sys__arch_8c" startline="311" endline="349">cond_wait</references>
        <references refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" compoundref="sys__arch_8c" startline="118">sys_sem::mutex</references>
        <references refid="ubthread_8h_1a13bf141cd3e9bf0921fbf61ffc637d8" compoundref="ubthread_8c" startline="81" endline="90">ubthread_mutex_lock</references>
        <references refid="ubthread_8h_1fea3530bab360f59c09a49f490d079dd" compoundref="ubthread_8c" startline="92" endline="103">ubthread_mutex_unlock</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_12ffdebd63f7a80c0233aa7460a816dff" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="409" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="409" bodyend="413"/>
        <references refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" compoundref="sys__arch_8c" startline="135" endline="153">current_thread</references>
        <references refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" compoundref="sys__arch_8c" startline="123">sys_thread::timeouts</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_129a81985c051357162ad079023a076cd" 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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="404" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="404" bodyend="407"/>
        <references refid="time_8h_1df30830f5265e55035171c301eb9c3fb" compoundref="time_8c" startline="110" endline="115">gettimeofday</references>
        <references refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" compoundref="sys__arch_8c" startline="128">starttime</references>
        <referencedby refid="init_8c_122b2914249628f6cba7d4e1f138c969f" compoundref="init_8c" startline="50" endline="63">net_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_15f93e13777922e6745f5aeb6bb27ee0b" 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 *mbox)</argsstring>
        <name>sys_mbox_free</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> *</type>
          <declname>mbox</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="215" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="215" bodyend="225"/>
        <references refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="351" endline="391">kfree</references>
        <references refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" compoundref="sys__arch_8c" startline="111">sys_mbox::mail</references>
        <references refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" compoundref="tcpip_8c" startline="56">mbox</references>
        <references refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" compoundref="sys__arch_8c" startline="112">sys_mbox::mutex</references>
        <references refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="def_8h" startline="41">NULL</references>
        <references refid="sys__arch_8h_1151f190d8a41cf6e2a02e0eec2b75355" compoundref="sys__arch_8h" startline="38">SYS_MBOX_NULL</references>
        <references refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" compoundref="sys__arch_8c" startline="385" endline="389">sys_sem_free_</references>
        <references refid="sys_8h_16c4530613bd616e719a295779b87ae5c">sys_sem_wait</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1fd77d183bb0693a21119223e72af96c2" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> *</type>
        <definition>struct sys_mbox* sys_mbox_new</definition>
        <argsstring>()</argsstring>
        <name>sys_mbox_new</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="204" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="204" bodyend="213"/>
        <references refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" compoundref="sys__arch_8c" startline="109">sys_mbox::first</references>
        <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references>
        <references refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" compoundref="sys__arch_8c" startline="109">sys_mbox::last</references>
        <references refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" compoundref="sys__arch_8c" startline="111">sys_mbox::mail</references>
        <references refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" compoundref="tcpip_8c" startline="56">mbox</references>
        <references refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" compoundref="sys__arch_8c" startline="112">sys_mbox::mutex</references>
        <references refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" compoundref="sys__arch_8c" startline="299" endline="309">sys_sem_new_</references>
        <referencedby refid="api__msg_8c_1c34376c05c2532858367dbdc2eec6ba0" compoundref="api__msg_8c" startline="160" endline="200">accept_function</referencedby>
        <referencedby refid="api__msg_8c_1c5f93428ba9863cd9b438edfd8715626" compoundref="api__msg_8c" startline="368" endline="398">do_listen</referencedby>
        <referencedby refid="api__lib_8c_1dc842fc0f1de512895ef3cc9c657272a" compoundref="api__lib_8c" startline="325" endline="352">netconn_bind</referencedby>
        <referencedby refid="api__lib_8c_140e08b372ad246ec7d2a7c9b1a2bd8fb" compoundref="api__lib_8c" startline="355" endline="386">netconn_connect</referencedby>
        <referencedby refid="api__lib_8c_1b917e0fc541447d966e5cf712ce24e58" compoundref="api__lib_8c" startline="389" endline="413">netconn_listen</referencedby>
        <referencedby refid="api__lib_8c_1b30ead34944094913a666250896ae95e" compoundref="api__lib_8c" startline="204" endline="224">netconn_new</referencedby>
        <referencedby refid="tcpip_8c_1aa3df02b3de2b41fe4bf7b2194e5e8e0" compoundref="tcpip_8c" startline="135" endline="141">tcpip_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_11e7a0edf077b67162d80fefffc8805fb" 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 *mbox, void *msg)</argsstring>
        <name>sys_mbox_post</name>
        <param>
          <type>struct <ref refid="structsys__mbox" kindref="compound">sys_mbox</ref> *</type>
          <declname>mbox</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>msg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="227" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="227" bodyend="252"/>
        <references refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" compoundref="sys__arch_8c" startline="109">sys_mbox::first</references>
        <references refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" compoundref="sys__arch_8c" startline="109">sys_mbox::last</references>
        <references refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" compoundref="sys__arch_8c" startline="111">sys_mbox::mail</references>
        <references refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" compoundref="tcpip_8c" startline="56">mbox</references>
        <references refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" compoundref="sys__arch_8c" startline="110">sys_mbox::msgs</references>
        <references refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" compoundref="sys__arch_8c" startline="112">sys_mbox::mutex</references>
        <references refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" compoundref="sys__arch_8c" startline="106">SYS_MBOX_SIZE</references>
        <references refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa">sys_sem_signal</references>
        <references refid="sys_8h_16c4530613bd616e719a295779b87ae5c">sys_sem_wait</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_199ef8b5ed640213c1d06d2622889131a" 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>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> *</type>
          <declname>sem</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="379" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="379" bodyend="383"/>
        <references refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" compoundref="sys__arch_8c" startline="385" endline="389">sys_sem_free_</references>
        <references refid="sys__arch_8h_1c66fcad3bfe79589054eb31765031544" compoundref="sys__arch_8h" startline="39">SYS_SEM_NULL</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void sys_sem_free_</definition>
        <argsstring>(struct sys_sem *sem)</argsstring>
        <name>sys_sem_free_</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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="131" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="385" bodyend="389"/>
        <references refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" compoundref="sys__arch_8c" startline="117">sys_sem::cond</references>
        <references refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="351" endline="391">kfree</references>
        <references refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" compoundref="sys__arch_8c" startline="118">sys_sem::mutex</references>
        <references refid="ubthread_8h_1e914fae69538736dc5e494c15ce93a17" compoundref="ubthread_8c" startline="64" endline="68">ubthread_cond_destroy</references>
        <references refid="ubthread_8h_1278f5d5b1e11b6668b75da6a285442e4" compoundref="ubthread_8c" startline="70" endline="74">ubthread_mutex_destroy</references>
        <referencedby refid="sys__arch_8c_15f93e13777922e6745f5aeb6bb27ee0b" compoundref="sys__arch_8c" startline="215" endline="225">sys_mbox_free</referencedby>
        <referencedby refid="sys__arch_8c_199ef8b5ed640213c1d06d2622889131a" compoundref="sys__arch_8c" startline="379" endline="383">sys_sem_free</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1cf9c4261c404aabc9b7a836f54207a57" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="structsys__sem" kindref="compound">sys_sem</ref> *</type>
        <definition>struct sys_sem* sys_sem_new</definition>
        <argsstring>(uInt8 count)</argsstring>
        <name>sys_sem_new</name>
        <param>
          <type><ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref></type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="295" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="295" bodyend="297"/>
        <references refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" compoundref="sys__arch_8c" startline="299" endline="309">sys_sem_new_</references>
        <referencedby refid="api__msg_8c_1c34376c05c2532858367dbdc2eec6ba0" compoundref="api__msg_8c" startline="160" endline="200">accept_function</referencedby>
        <referencedby refid="api__lib_8c_19363929b6c680bc1dd3f302885128959" compoundref="api__lib_8c" startline="537" endline="609">netconn_write</referencedby>
        <referencedby refid="init_8c_1ced8bfa512e574c34b87586a3de7a94a" compoundref="init_8c" startline="66" endline="92">netMainThread</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structsys__sem" kindref="compound">sys_sem</ref> *</type>
        <definition>static struct sys_sem * sys_sem_new_</definition>
        <argsstring>(uInt8 count)</argsstring>
        <name>sys_sem_new_</name>
        <param>
          <type><ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref></type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="130" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="299" bodyend="309"/>
        <references refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" compoundref="sys__arch_8c" startline="116">sys_sem::c</references>
        <references refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" compoundref="sys__arch_8c" startline="117">sys_sem::cond</references>
        <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references>
        <references refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" compoundref="sys__arch_8c" startline="118">sys_sem::mutex</references>
        <references refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="def_8h" startline="41">NULL</references>
        <references refid="ubthread_8h_1cbb7170a68758468ab5b02512a320112" compoundref="ubthread_8c" startline="48" endline="54">ubthread_cond_init</references>
        <references refid="ubthread_8h_1b6bfc2169b55532821582f24b68dc855" compoundref="ubthread_8c" startline="56" endline="62">ubthread_mutex_init</references>
        <referencedby refid="sys__arch_8c_1fd77d183bb0693a21119223e72af96c2" compoundref="sys__arch_8c" startline="204" endline="213">sys_mbox_new</referencedby>
        <referencedby refid="sys__arch_8c_1cf9c4261c404aabc9b7a836f54207a57" compoundref="sys__arch_8c" startline="295" endline="297">sys_sem_new</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_15dba9c7e95633e472717c75a21d96283" 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 *sem)</argsstring>
        <name>sys_sem_signal</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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="370" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="370" bodyend="377"/>
        <references refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" compoundref="sys__arch_8c" startline="116">sys_sem::c</references>
        <references refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" compoundref="sys__arch_8c" startline="117">sys_sem::cond</references>
        <references refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" compoundref="sys__arch_8c" startline="118">sys_sem::mutex</references>
        <references refid="ubthread_8h_164fb8f5f2da2564a6cae8c9f2c3bde10" compoundref="ubthread_8c" startline="125" endline="129">ubthread_cond_signal</references>
        <references refid="ubthread_8h_1a13bf141cd3e9bf0921fbf61ffc637d8" compoundref="ubthread_8c" startline="81" endline="90">ubthread_mutex_lock</references>
        <references refid="ubthread_8h_1fea3530bab360f59c09a49f490d079dd" compoundref="ubthread_8c" startline="92" endline="103">ubthread_mutex_unlock</references>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1eb9b7d7cea295be85b0b0ddb7c9fe566" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void sys_thread_new</definition>
        <argsstring>(void(*function)(void), void *arg)</argsstring>
        <name>sys_thread_new</name>
        <param>
          <type>void(*)(void)</type>
          <declname>function</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>arg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="172" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="172" bodyend="202"/>
        <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references>
        <references refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" compoundref="kpanic_8c" startline="44" endline="62">kpanic</references>
        <references refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" compoundref="kprintf_8c" startline="38" endline="49">kprintf</references>
        <references refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" compoundref="sys__arch_8c" startline="99">netThreadSpinlock</references>
        <references refid="structsys__timeouts_180922134cf5f7db06829b6ee49b4954c" compoundref="sys_8h" startline="51">sys_timeouts::next</references>
        <references refid="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" compoundref="sys__arch_8c" startline="122">sys_thread::next</references>
        <references refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="def_8h" startline="41">NULL</references>
        <references refid="spinlock_8h_12cd9a4502680fb8e7f0fe6b029e558b1" compoundref="spinlock_8c" startline="56" endline="62">spinLock</references>
        <references refid="spinlock_8h_1dd996cbbb3b9826dd9c8cf02b66a4c65" compoundref="spinlock_8c" startline="37" endline="46">spinUnlock</references>
        <references refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" compoundref="sys__arch_8c" startline="98">threads</references>
        <references refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" compoundref="sys__arch_8c" startline="123">sys_thread::timeouts</references>
        <references refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" compoundref="sys__arch_8c" startline="124">sys_thread::ubthread</references>
        <references refid="ubthread_8h_1a0af177ef44888f3c93883294207328e" compoundref="ubthread_8c" startline="76" endline="79">ubthread_create</references>
        <referencedby refid="bot_8c_1e5e17afd28772b096c68d413334b257a" compoundref="bot_8c" startline="83" endline="85">bot_init</referencedby>
        <referencedby refid="ethernetif_8c_115915c49a70d85ff1c6af793cda34419" compoundref="ethernetif_8c" startline="81" endline="101">low_level_init</referencedby>
        <referencedby refid="init_8c_122b2914249628f6cba7d4e1f138c969f" compoundref="init_8c" startline="50" endline="63">net_init</referencedby>
        <referencedby refid="shell_8h_169b075ef7e4d7bcf5a903d3d75baac02" compoundref="shell_8c" startline="114" endline="116">shell_init</referencedby>
        <referencedby refid="tcpip_8c_1aa3df02b3de2b41fe4bf7b2194e5e8e0" compoundref="tcpip_8c" startline="135" endline="141">tcpip_init</referencedby>
        <referencedby refid="udpecho_8h_1b288cc2f0b684d8cffe7f074724127e2" compoundref="udpecho_8c" startline="78" endline="81">udpecho_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="sys__arch_8c_1a40706a5e306545035127c0cf198cf49" 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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="391" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="391" bodyend="402"/>
        <references refid="time_8h_1df30830f5265e55035171c301eb9c3fb" compoundref="time_8c" startline="110" endline="115">gettimeofday</references>
        <references refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" compoundref="sys__arch_8c" startline="128">starttime</references>
        <references refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" compoundref="time_8h" startline="73">timeval::tv_sec</references>
        <references refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" compoundref="time_8h" startline="74">timeval::tv_usec</references>
      </memberdef>
      </sectiondef>
      <sectiondef kind="var">
      <memberdef kind="variable" id="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" prot="public" static="yes" mutable="no">
        <type><ref refid="spinlock_8h_1a240e9404b4ede1e0d714610080d1176" kindref="member">spinLock_t</ref></type>
        <definition>spinLock_t netThreadSpinlock</definition>
        <argsstring></argsstring>
        <name>netThreadSpinlock</name>
        <initializer> SPIN_LOCK_INITIALIZER</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="99" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="99" bodyend="-1"/>
        <referencedby refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" compoundref="sys__arch_8c" startline="135" endline="153">current_thread</referencedby>
        <referencedby refid="sys__arch_8c_1eb9b7d7cea295be85b0b0ddb7c9fe566" compoundref="sys__arch_8c" startline="172" endline="202">sys_thread_new</referencedby>
      </memberdef>
      <memberdef kind="variable" id="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" 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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="128" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="128" bodyend="-1"/>
        <referencedby refid="sys__arch_8c_129a81985c051357162ad079023a076cd" compoundref="sys__arch_8c" startline="404" endline="407">sys_init</referencedby>
        <referencedby refid="sys__arch_8c_1a40706a5e306545035127c0cf198cf49" compoundref="sys__arch_8c" startline="391" endline="402">sys_unix_now</referencedby>
      </memberdef>
      <memberdef kind="variable" id="sys__arch_8c_115905349139e42ffd3f853e8daae250f" 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="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" line="98" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c" bodystart="98" bodyend="-1"/>
        <referencedby refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" compoundref="sys__arch_8c" startline="135" endline="153">current_thread</referencedby>
        <referencedby refid="sys__arch_8c_1eb9b7d7cea295be85b0b0ddb7c9fe566" compoundref="sys__arch_8c" startline="172" endline="202">sys_thread_new</referencedby>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001,<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.<sp/></highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/></highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/>modification,<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/></highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>are<sp/>met:<sp/></highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/></highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.<sp/></highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/></highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/></highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>documentation<sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.<sp/></highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/>3.<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>Institute<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/></highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>may<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/></highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.<sp/></highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>INSTITUTE<sp/>AND<sp/>CONTRIBUTORS<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/></highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/></highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/></highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/>ARE<sp/>DISCLAIMED.<sp/><sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>INSTITUTE<sp/>OR<sp/>CONTRIBUTORS<sp/>BE<sp/>LIABLE<sp/></highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/></highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/></highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/></highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>CONTRACT,<sp/>STRICT<sp/></highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/></highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/></highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*<sp/>SUCH<sp/>DAMAGE.<sp/></highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/></highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>Author:<sp/><sp/><sp/><sp/><sp/>Adam<sp/>Dunkels<sp/><sp/><sp/><sp/><sp/><sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/>Sub<sp/>Author:<sp/>Christopher<sp/>Olsen<sp/>&lt;colsen@domaintlantic.com&gt;</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*<sp/>Notes:</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/><sp/>Modified<sp/>to<sp/>work<sp/>with<sp/>the<sp/>ubix<sp/>operating<sp/>system</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>$Log: sys__arch_8c.xml,v $
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>Revision 1.4  2006/12/12 14:09:16  reddawg
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>Changes
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/></highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.1.1.1<sp/><sp/>2006/06/01<sp/>12:46:16<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>ubix2</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.2<sp/><sp/>2005/10/12<sp/>00:13:37<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*<sp/>Removed</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.1.1.1<sp/><sp/>2005/09/26<sp/>17:24:31<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>*<sp/>no<sp/>message</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.6<sp/><sp/>2004/09/11<sp/>21:30:37<sp/><sp/>apwillia</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/>*<sp/>Fix<sp/>race<sp/>conditions<sp/>in<sp/>net<sp/>thread<sp/>and<sp/>scheduler</highlight></codeline>
<codeline lineno="49"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="50"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.5<sp/><sp/>2004/09/07<sp/>20:58:35<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/>*<sp/>time<sp/>to<sp/>roll<sp/>back<sp/>i<sp/>can&apos;t<sp/>think<sp/>straight<sp/>by<sp/>friday</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.4<sp/><sp/>2004/05/25<sp/>22:49:29<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="54"><highlight class="comment"><sp/>*<sp/>Stupid<sp/>Old<sp/>CODE!!!</highlight></codeline>
<codeline lineno="55"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="56"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.3<sp/><sp/>2004/05/19<sp/>04:07:43<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="57"><highlight class="comment"><sp/>*<sp/>kmalloc(size,pid)<sp/>no<sp/>more<sp/>it<sp/>is<sp/>no<sp/>kmalloc(size);<sp/>the<sp/>way<sp/>it<sp/>should<sp/>of<sp/>been</highlight></codeline>
<codeline lineno="58"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="59"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.2<sp/><sp/>2004/05/19<sp/>03:35:02<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="60"><highlight class="comment"><sp/>*<sp/>Fixed<sp/>A<sp/>Few<sp/>Ordering<sp/>Issues<sp/>In<sp/>The<sp/>Service<sp/>Startup<sp/>Routine</highlight></codeline>
<codeline lineno="61"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="62"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.1.1.1<sp/><sp/>2004/04/15<sp/>12:07:14<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="63"><highlight class="comment"><sp/>*<sp/>UbixOS<sp/>v1.0</highlight></codeline>
<codeline lineno="64"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="65"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.13<sp/><sp/>2004/04/13<sp/>21:29:53<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="66"><highlight class="comment"><sp/>*<sp/>We<sp/>now<sp/>have<sp/>sockets<sp/>working.<sp/>Lots<sp/>of<sp/>functionality<sp/>to<sp/>be<sp/>added<sp/>to<sp/>continually</highlight></codeline>
<codeline lineno="67"><highlight class="comment"><sp/>*<sp/>improve<sp/>on<sp/>the<sp/>existing<sp/>layers<sp/>now<sp/>its<sp/>clean<sp/>up<sp/>time<sp/>to<sp/>get<sp/>things<sp/>in<sp/>a<sp/>better</highlight></codeline>
<codeline lineno="68"><highlight class="comment"><sp/>*<sp/>working<sp/>order.</highlight></codeline>
<codeline lineno="69"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="70"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.12<sp/><sp/>2004/04/13<sp/>16:08:07<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="71"><highlight class="comment"><sp/>*<sp/>Removed<sp/>all<sp/>of<sp/>the<sp/>old<sp/>debug<sp/>code<sp/>the<sp/>problem<sp/>seems<sp/>to<sp/>be<sp/>in<sp/>ubthreads<sp/>with</highlight></codeline>
<codeline lineno="72"><highlight class="comment"><sp/>*<sp/>ubthread_mutex_init</highlight></codeline>
<codeline lineno="73"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="74"><highlight class="comment"><sp/>*<sp/>Revision<sp/>1.11<sp/><sp/>2004/04/13<sp/>16:05:40<sp/><sp/>reddawg</highlight></codeline>
<codeline lineno="75"><highlight class="comment"><sp/>*<sp/>Function<sp/>Renaming</highlight></codeline>
<codeline lineno="76"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="77"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="78"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="79"><highlight class="comment"><sp/>*<sp/>$Id: sys__arch_8c.xml 88 2016-01-12 00:11:29Z reddawg $</highlight></codeline>
<codeline lineno="80"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="types_8h" kindref="compound">ubixos/types.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><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="84"><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="85"><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="86"><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="87"><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="88"><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><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="90"><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="91"><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="92"><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="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><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="95"><highlight class="normal"></highlight></codeline>
<codeline lineno="96" refid="sys__arch_8c_155b0bf94baa06c302a48157cd42cd676" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UMAX(a,<sp/>b)<sp/><sp/><sp/><sp/><sp/><sp/>((a)<sp/>&gt;<sp/>(b)<sp/>?<sp/>(a)<sp/>:<sp/>(b))</highlight></codeline>
<codeline lineno="97"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98" refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" refkind="member"><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/>*<ref refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" kindref="member">threads</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="99" refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="spinlock_8h_1a240e9404b4ede1e0d714610080d1176" kindref="member">spinLock_t</ref><sp/><ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref><sp/>=<sp/><ref refid="spinlock_8h_10fe85a4f3642683148b25916d6c5eafd" kindref="member">SPIN_LOCK_INITIALIZER</ref>;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight></codeline>
<codeline lineno="101" refid="structsys__mbox__msg" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox__msg" kindref="compound">sys_mbox_msg</ref><sp/>{</highlight></codeline>
<codeline lineno="102" refid="structsys__mbox__msg_1aee9d483ae1aedfb4c5ebea30cd2f84b" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox__msg" kindref="compound">sys_mbox_msg</ref><sp/>*<ref refid="structsys__mbox__msg_1aee9d483ae1aedfb4c5ebea30cd2f84b" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="103" refid="structsys__mbox__msg_15902d8670558a8892e739c37804e20e5" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structsys__mbox__msg_15902d8670558a8892e739c37804e20e5" kindref="member">msg</ref>;</highlight></codeline>
<codeline lineno="104"><highlight class="normal">};</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106" refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SYS_MBOX_SIZE<sp/>100</highlight></codeline>
<codeline lineno="107"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="108" refid="structsys__mbox" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>{</highlight></codeline>
<codeline lineno="109" refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/><ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref>,<sp/><ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref>;</highlight></codeline>
<codeline lineno="110" refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" kindref="member">msgs</ref>[<ref refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>];</highlight></codeline>
<codeline lineno="111" refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" refkind="member"><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/>*<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref>;</highlight></codeline>
<codeline lineno="112" refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" refkind="member"><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/>*<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>;</highlight></codeline>
<codeline lineno="113"><highlight class="normal">};</highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight></codeline>
<codeline lineno="115" refid="structsys__sem" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>{</highlight></codeline>
<codeline lineno="116" refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" refkind="member"><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/><ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref>;</highlight></codeline>
<codeline lineno="117" refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref><sp/><ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>;</highlight></codeline>
<codeline lineno="118" refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref><sp/><ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>;</highlight></codeline>
<codeline lineno="119"><highlight class="normal">};</highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight></codeline>
<codeline lineno="121" refid="structsys__thread" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__thread" kindref="compound">sys_thread</ref><sp/>{</highlight></codeline>
<codeline lineno="122" refid="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" 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="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="123" refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__timeouts" kindref="compound">sys_timeouts</ref><sp/><ref refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" kindref="member">timeouts</ref>;</highlight></codeline>
<codeline lineno="124" refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*<ref refid="structubthread" kindref="compound">ubthread</ref>;</highlight></codeline>
<codeline lineno="125"><highlight class="normal">};</highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight></codeline>
<codeline lineno="128" refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" refkind="member"><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/><ref refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" kindref="member">starttime</ref>;</highlight></codeline>
<codeline lineno="129"><highlight class="normal"></highlight></codeline>
<codeline lineno="130"><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/>*<ref refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" kindref="member">sys_sem_new_</ref>(<ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>count);</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" 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);</highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/><ref refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" kindref="member">cond_wait</ref>(<ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref><sp/>*<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>,<sp/><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref><sp/>*<ref refid="ubthread_8c_118b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>timeout);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"></highlight></codeline>
<codeline lineno="135" refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" refkind="member"><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/>*<ref refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" kindref="member">current_thread</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="136"><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="137"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*pt;</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/>pt<sp/>=<sp/><ref refid="ubthread_8h_172a362bc8127b8d63e1107062638664d" kindref="member">ubthread_self</ref>();</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><ref refid="spinlock_8h_12cd9a4502680fb8e7f0fe6b029e558b1" kindref="member">spinLock</ref>(&amp;<ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref>);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(st<sp/>=<sp/><ref refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" kindref="member">threads</ref>;<sp/>st<sp/>!=<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>st<sp/>=<sp/>st-&gt;<ref refid="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(st-&gt;<ref refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref><sp/>==<sp/>pt)<sp/>{</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="spinlock_8h_1dd996cbbb3b9826dd9c8cf02b66a4c65" kindref="member">spinUnlock</ref>(&amp;<ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref>);</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>st;</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><ref refid="spinlock_8h_1dd996cbbb3b9826dd9c8cf02b66a4c65" kindref="member">spinUnlock</ref>(&amp;<ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref>);</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="148"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="149"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="150"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;ABORT&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0x0);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="154"><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="156" 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="157" refid="structthread__start__param_16cf526706b3be43bb00e750118687148" 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" kindref="compound">thread</ref>;</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/>void<sp/>(*<sp/><ref refid="structthread__start__param_17773a5446ce0e9e9badc6489d9f097ff" kindref="member">function</ref>)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*);</highlight></codeline>
<codeline lineno="159" refid="structthread__start__param_1371e37a29e019c871fda24c2118c2896" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structthread__start__param_1371e37a29e019c871fda24c2118c2896" kindref="member">arg</ref>;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/>};</highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="163"><highlight class="comment">static<sp/>void<sp/>*thread_start(void<sp/>*arg)<sp/>{</highlight></codeline>
<codeline lineno="164"><highlight class="comment"><sp/><sp/>struct<sp/>thread_start_param<sp/>*tp<sp/>=<sp/>arg;</highlight></codeline>
<codeline lineno="165"><highlight class="comment"><sp/><sp/>tp-&gt;thread-&gt;ubthread<sp/>=<sp/>ubthread_self();</highlight></codeline>
<codeline lineno="166"><highlight class="comment"><sp/><sp/>tp-&gt;function(tp-&gt;arg);</highlight></codeline>
<codeline lineno="167"><highlight class="comment"><sp/><sp/>kfree(tp);</highlight></codeline>
<codeline lineno="168"><highlight class="comment"><sp/><sp/>return(NULL);</highlight></codeline>
<codeline lineno="169"><highlight class="comment"><sp/><sp/>}</highlight></codeline>
<codeline lineno="170"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"></highlight></codeline>
<codeline lineno="172" refid="sys__arch_8c_1eb9b7d7cea295be85b0b0ddb7c9fe566" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1eb9b7d7cea295be85b0b0ddb7c9fe566" kindref="member">sys_thread_new</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>(*<sp/>function)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">),<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg)<sp/>{</highlight></codeline>
<codeline lineno="173"><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><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="174"><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="175"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;sys_thread:<sp/>[0x%X]\n&quot;</highlight><highlight class="normal">,</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="176"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/>thread<sp/>=<sp/><ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>sys_thread));</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;THREAD:<sp/>[0x%X]\n&quot;</highlight><highlight class="normal">,thread);</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><ref refid="spinlock_8h_12cd9a4502680fb8e7f0fe6b029e558b1" kindref="member">spinLock</ref>(&amp;<ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref>);</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/>thread-&gt;<ref refid="structsys__thread_130bbf3f21718b4c9579777d2ba4d6528" kindref="member">next</ref><sp/>=<sp/><ref refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" kindref="member">threads</ref>;</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/>thread-&gt;<ref refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" kindref="member">timeouts</ref>.<ref refid="structsys__timeouts_180922134cf5f7db06829b6ee49b4954c" kindref="member">next</ref><sp/>=<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/>thread-&gt;<ref refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><ref refid="sys__arch_8c_115905349139e42ffd3f853e8daae250f" kindref="member">threads</ref><sp/>=<sp/>thread;</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><ref refid="spinlock_8h_1dd996cbbb3b9826dd9c8cf02b66a4c65" kindref="member">spinUnlock</ref>(&amp;<ref refid="sys__arch_8c_1ca0303cc326b3efc7d32b4a794ddeb61" kindref="member">netThreadSpinlock</ref>);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="186"><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="188"><highlight class="comment"><sp/><sp/>thread_param<sp/>=<sp/>kmalloc(sizeof(struct<sp/>thread_start_param));</highlight></codeline>
<codeline lineno="189"><highlight class="comment"><sp/><sp/></highlight></codeline>
<codeline lineno="190"><highlight class="comment"><sp/><sp/>thread_param-&gt;function<sp/>=<sp/>function;</highlight></codeline>
<codeline lineno="191"><highlight class="comment"><sp/><sp/>thread_param-&gt;arg<sp/>=<sp/>arg;</highlight></codeline>
<codeline lineno="192"><highlight class="comment"><sp/><sp/>thread_param-&gt;thread<sp/>=<sp/>thread;</highlight></codeline>
<codeline lineno="193"><highlight class="comment"><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//execThread((void<sp/>*)function,0x0,0x0);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/></highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;thread-&gt;ubthread:<sp/>[0x%X]\n&quot;</highlight><highlight class="normal">,thread-&gt;<ref refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref>);</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ubthread_8h_1a0af177ef44888f3c93883294207328e" kindref="member">ubthread_create</ref>(&amp;thread-&gt;<ref refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref>,<sp/>0x0,(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)(function),<sp/>arg)<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;sys_thread_new:<sp/>ubthread_create&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;thread-&gt;ubthread:<sp/>[0x%X]\n&quot;</highlight><highlight class="normal">,thread-&gt;<ref refid="structsys__thread_1109a6dc4db2e0d62aa546ce36f3fbc1b" kindref="member">ubthread</ref>);<sp/></highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight></codeline>
<codeline lineno="204" refid="sys__arch_8c_1fd77d183bb0693a21119223e72af96c2" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__mbox" kindref="compound">sys_mbox</ref><sp/>*<ref refid="sys_8h_13b766e6df37d63d5f1144c5089c2af94" kindref="member">sys_mbox_new</ref>()<sp/>{</highlight></codeline>
<codeline lineno="205"><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/>*<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref><sp/>=<sp/><ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" 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="208"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref><sp/>=<sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref><sp/>=<sp/><ref refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" kindref="member">sys_sem_new_</ref>(0);</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref><sp/>=<sp/><ref refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" kindref="member">sys_sem_new_</ref>(1);</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>);</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="215" refid="sys__arch_8c_15f93e13777922e6745f5aeb6bb27ee0b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_166160e039d0222f4dd8534cd3ab84699" 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/>*<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>)<sp/>{</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref><sp/>!=<sp/><ref refid="sys__arch_8h_1151f190d8a41cf6e2a02e0eec2b75355" kindref="member">SYS_MBOX_NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_16c4530613bd616e719a295779b87ae5c" kindref="member">sys_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" kindref="member">sys_sem_free_</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref>);</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" kindref="member">sys_sem_free_</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref><sp/>=<sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref><sp/>=<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf(&quot;sys_mbox_free:<sp/>mbox<sp/>0x%lx\n&quot;,<sp/>mbox);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>);</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="226"><highlight class="normal"></highlight></codeline>
<codeline lineno="227" refid="sys__arch_8c_11e7a0edf077b67162d80fefffc8805fb" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1217a9af37c5dd7c3fc16daddaacb976f" 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/>*<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*msg)<sp/>{</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/><ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref>;</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_16c4530613bd616e719a295779b87ae5c" kindref="member">sys_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(&quot;sys_mbox_post:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;,<sp/>mbox,<sp/>msg);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"></highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" kindref="member">msgs</ref>[<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref>]<sp/>=<sp/>msg;</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref><sp/>==<sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref>)<sp/>{</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/>first<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/>first<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref>++;</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref><sp/>==<sp/><ref refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(first)<sp/>{</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa" kindref="member">sys_sem_signal</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref>);</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa" kindref="member">sys_sem_signal</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="253"><highlight class="normal"></highlight></codeline>
<codeline lineno="254" refid="sys__arch_8c_1d3bc5455ca12b164bfc78974ff0c1e3c" refkind="member"><highlight class="normal"><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/><ref refid="sys_8h_194ffa3f15cc0eda6dae85c6ccb88da6e" 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/>*<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**msg,<sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>time<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="257"><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="258"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>stuff<sp/>here.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937" kindref="member">sys_arch_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref><sp/>==<sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1e88d235ceab3354ef612e0be18456a01" kindref="member">last</ref>)<sp/>{</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa" kindref="member">sys_sem_signal</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="264"><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="265"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>must<sp/>be<sp/>prepared<sp/>to<sp/>timeout.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(timeout<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>time<sp/>=<sp/><ref refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937" kindref="member">sys_arch_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref>,<sp/>timeout);</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>time<sp/>==<sp/>0,<sp/>the<sp/>sem_wait<sp/>timed<sp/>out,<sp/>and<sp/>we<sp/>return<sp/>0.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(time<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937" kindref="member">sys_arch_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_155a1a2b60ec2ffc998debbcdb68cb6fd" kindref="member">mail</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937" kindref="member">sys_arch_sem_wait</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(msg<sp/>!=<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf(&quot;sys_mbox_fetch:<sp/>mbox<sp/>%p<sp/>msg<sp/>%p\n&quot;,<sp/>mbox,<sp/>*msg);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/>*msg<sp/>=<sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_1dc8ebbfd1d184d1edbd541903597cc5a" kindref="member">msgs</ref>[<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref>];</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref>++;</highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref><sp/>==<sp/><ref refid="sys__arch_8c_1b6084e542da137ecb93bb42ce1087518" kindref="member">SYS_MBOX_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_18db17d5a2fed5c240e46f2644f64fe6b" kindref="member">first</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/>}<sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa" kindref="member">sys_sem_signal</ref>(<ref refid="tcpip_8c_1189da3fa172ad9c1b0491dcb4857fee6" kindref="member">mbox</ref>-&gt;<ref refid="structsys__mbox_14c3d45a63605eee5abf52b98914ad5c7" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(time);</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="294"><highlight class="normal"></highlight></codeline>
<codeline lineno="295" refid="sys__arch_8c_1cf9c4261c404aabc9b7a836f54207a57" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsys__sem" kindref="compound">sys_sem</ref><sp/>*<ref refid="sys_8h_1adf2563f342b33ff6033eaa12f642e9d" kindref="member">sys_sem_new</ref>(<ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" kindref="member">sys_sem_new_</ref>(count);</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="298"><highlight class="normal"></highlight></codeline>
<codeline lineno="299" refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" refkind="member"><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/>*<ref refid="sys__arch_8c_17e7a76cc67fb974dbc234d15f9b885fe" kindref="member">sys_sem_new_</ref>(<ref refid="types_8h_1a4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="300"><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="301"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/>sem<sp/>=<sp/><ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" 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="303"><highlight class="normal"><sp/><sp/>sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref><sp/>=<sp/>count;</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1cbb7170a68758468ab5b02512a320112" kindref="member">ubthread_cond_init</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1b6bfc2169b55532821582f24b68dc855" kindref="member">ubthread_mutex_init</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/><ref refid="def_8h_1070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>sem;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="310"><highlight class="normal"></highlight></codeline>
<codeline lineno="311" refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/><ref refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" kindref="member">cond_wait</ref>(<ref refid="structubthread__cond" kindref="compound">ubthread_cond_t</ref><sp/>*<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>,<sp/><ref refid="structubthread__mutex" kindref="compound">ubthread_mutex_t</ref><sp/>*<ref refid="ubthread_8c_118b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="312"><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="313"><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="314"><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="315"><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="316"><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="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>retval;</highlight></codeline>
<codeline lineno="318"><highlight class="normal"></highlight></codeline>
<codeline lineno="319"><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="320"><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="321"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="time_8h_1df30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;rtime1,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/>sec<sp/>=<sp/>rtime1.<ref refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" kindref="member">tv_sec</ref>;</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>=<sp/>rtime1.<ref refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>;</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>+=<sp/>timeout<sp/>%<sp/>1000<sp/>*<sp/>1000;<sp/><sp/></highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/>sec<sp/>+=<sp/>(int)(timeout<sp/>/<sp/>1000)<sp/>+<sp/>(int)(usec<sp/>/<sp/>1000000);</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/>usec<sp/>=<sp/>usec<sp/>%<sp/>1000000;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/>ts.<ref refid="structtimespec_1e3c7510dafa8cbcaede866ed13c99683" kindref="member">tv_nsec</ref><sp/>=<sp/>usec<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/>ts.<ref refid="structtimespec_1fc3302668d7cb5952f590da69fdd4955" kindref="member">tv_sec</ref><sp/>=<sp/>sec;</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/>retval<sp/>=<sp/><ref refid="ubthread_8h_1996be9a927447a62f7168a082a046c54" kindref="member">ubthread_cond_timedwait</ref>(cond,<sp/><ref refid="ubthread_8c_118b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>,<sp/>&amp;ts);</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(retval<sp/>==<sp/><ref refid="ubthread_8h_1597718e59a8fc9c4d4ab63f5a34e28b1" kindref="member">ETIMEDOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="335"><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="336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="time_8h_1df30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;rtime2,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tdiff<sp/>=<sp/>(rtime2.<ref refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" kindref="member">tv_sec</ref><sp/>-<sp/>rtime1.<ref refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" kindref="member">tv_sec</ref>)<sp/>*<sp/>1000<sp/>+<sp/><sp/></highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(rtime2.<ref refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref><sp/>-<sp/>rtime1.<ref refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>)<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="339"><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="340"><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="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tdiff;</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_130eb7c156c2422801ddb86326dbc3d81" kindref="member">ubthread_cond_wait</ref>(cond,<sp/><ref refid="ubthread_8c_118b6be9ca0cec4b0643171232d6f10de" kindref="member">mutex</ref>);</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="350"><highlight class="normal"></highlight></codeline>
<codeline lineno="351" refid="sys__arch_8c_1af7b79a80d625789c95cb20b565424fd" refkind="member"><highlight class="normal"><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/><ref refid="sys_8h_1bf9681f6dcec783b38693e9d0b7af937" 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/>*sem,<sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>timeout)<sp/>{</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><ref refid="types_8h_13b65128d2644e9b80cec9a69bfa7e094" kindref="member">uInt16</ref><sp/>time<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1a13bf141cd3e9bf0921fbf61ffc637d8" kindref="member">ubthread_mutex_lock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref><sp/>&lt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(timeout<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>time<sp/>=<sp/><ref refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" kindref="member">cond_wait</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/>&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/>timeout);</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(time<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ubthread_8h_1fea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sys__arch_8c_1acaa002113dc0d59d767efbb1382e1ca" kindref="member">cond_wait</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/>&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/>0);</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/>sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref>--;</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1fea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(time);</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="369"><highlight class="normal"></highlight></codeline>
<codeline lineno="370" refid="sys__arch_8c_15dba9c7e95633e472717c75a21d96283" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1dcdd78b22487e983e7636c636292fbfa" 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/>*sem)<sp/>{</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1a13bf141cd3e9bf0921fbf61ffc637d8" kindref="member">ubthread_mutex_lock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/>sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref>++;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref><sp/>&gt;<sp/>1)</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/>sem-&gt;<ref refid="structsys__sem_17b9a8512154232d0c7cd8b007ccabca0" kindref="member">c</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_164fb8f5f2da2564a6cae8c9f2c3bde10" kindref="member">ubthread_cond_signal</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>));</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1fea3530bab360f59c09a49f490d079dd" kindref="member">ubthread_mutex_unlock</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="378"><highlight class="normal"></highlight></codeline>
<codeline lineno="379" refid="sys__arch_8c_199ef8b5ed640213c1d06d2622889131a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1f36773453b6a4db5ae71afef8bb77184" 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="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(sem<sp/>!=<sp/><ref refid="sys__arch_8h_1c66fcad3bfe79589054eb31765031544" kindref="member">SYS_SEM_NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" kindref="member">sys_sem_free_</ref>(sem);</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="384"><highlight class="normal"></highlight></codeline>
<codeline lineno="385" refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys__arch_8c_12c773782116a4e712bd8d4c591ab50d4" 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="386"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1e914fae69538736dc5e494c15ce93a17" kindref="member">ubthread_cond_destroy</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_1a758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>));</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1278f5d5b1e11b6668b75da6a285442e4" kindref="member">ubthread_mutex_destroy</ref>(&amp;(sem-&gt;<ref refid="structsys__sem_152b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(sem);</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="390"><highlight class="normal"></highlight></codeline>
<codeline lineno="391" refid="sys__arch_8c_1a40706a5e306545035127c0cf198cf49" 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_1a40706a5e306545035127c0cf198cf49" kindref="member">sys_unix_now</ref>()<sp/>{</highlight></codeline>
<codeline lineno="392"><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="393"><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="394"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>sec,<sp/>usec;</highlight></codeline>
<codeline lineno="395"><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="396"><highlight class="normal"><sp/><sp/><ref refid="time_8h_1df30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;tv,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="397"><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>sec<sp/>=<sp/>tv.<ref refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" kindref="member">tv_sec</ref><sp/>-<sp/><ref refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" kindref="member">starttime</ref>.<ref refid="structtimeval_13599199839a89e99a2ce29d45312b5cf" kindref="member">tv_sec</ref>;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/>usec<sp/>=<sp/>tv.<ref refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref><sp/>-<sp/><ref refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" kindref="member">starttime</ref>.<ref refid="structtimeval_1810bf8fcd58e255a5c1896d19538b86a" kindref="member">tv_usec</ref>;</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/>msec<sp/>=<sp/>sec<sp/>*<sp/>1000<sp/>+<sp/>usec<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>msec;</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="403"><highlight class="normal"></highlight></codeline>
<codeline lineno="404" refid="sys__arch_8c_129a81985c051357162ad079023a076cd" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="sys_8h_1f411a8bc6b7ed4b0af9114e10c959448" kindref="member">sys_init</ref>()<sp/>{</highlight></codeline>
<codeline lineno="405"><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="406"><highlight class="normal"><sp/><sp/><ref refid="time_8h_1df30830f5265e55035171c301eb9c3fb" kindref="member">gettimeofday</ref>(&amp;<ref refid="sys__arch_8c_1726d4f4e11d7b38233574938939e0db9" kindref="member">starttime</ref>,<sp/>&amp;tz);</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="408"><highlight class="normal"></highlight></codeline>
<codeline lineno="409" refid="sys__arch_8c_12ffdebd63f7a80c0233aa7460a816dff" 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_8h_12ffdebd63f7a80c0233aa7460a816dff" kindref="member">sys_arch_timeouts</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="410"><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="411"><highlight class="normal"><sp/><sp/>thread<sp/>=<sp/><ref refid="sys__arch_8c_1c216bafdd6453f68ef27dc764b134e94" kindref="member">current_thread</ref>();</highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(&amp;thread-&gt;<ref refid="structsys__thread_1bf0a0f75b1958421416c879d8011413b" kindref="member">timeouts</ref>);</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="414"><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"></highlight><highlight class="comment">/***</highlight></codeline>
<codeline lineno="416"><highlight class="comment"><sp/>END</highlight></codeline>
<codeline lineno="417"><highlight class="comment"><sp/>***/</highlight><highlight class="normal"></highlight></codeline>
    </programlisting>
    <location file="/usr/home/reddawg/source/ubix2/src/sys/net/net/sys_arch.c"/>
  </compounddef>
</doxygen>
