\hypertarget{usb__process_8c_source}{}\doxysection{usb\+\_\+process.\+c}
\label{usb__process_8c_source}\index{dev/usb/usb\_process.c@{dev/usb/usb\_process.c}}
\mbox{\hyperlink{usb__process_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00001}00001 \textcolor{comment}{/* \$FreeBSD\$ */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00002}00002 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00003}00003 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00029}00029 \textcolor{preprocessor}{\#ifdef USB\_GLOBAL\_INCLUDE\_FILE}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00030}00030 \textcolor{preprocessor}{\#include USB\_GLOBAL\_INCLUDE\_FILE}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00031}00031 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/stdint.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/stddef.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/types.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/condvar.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/sx.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/unistd.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/callout.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/priv.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb_8h}{dev/usb/usb.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi_8h}{dev/usb/usbdi.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi__util_8h}{dev/usb/usbdi\_util.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__process_8h}{dev/usb/usb\_process.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00056}\mbox{\hyperlink{usb__process_8c_a927dd6f59caf10a2991dfb564bcbb1e1}{00056}} \textcolor{preprocessor}{\#define USB\_DEBUG\_VAR usb\_proc\_debug}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__debug_8h}{dev/usb/usb\_debug.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__util_8h}{dev/usb/usb\_util.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <sys/kthread.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <sys/sched.h>}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00063}00063 \textcolor{preprocessor}{\#endif                  }\textcolor{comment}{/* USB\_GLOBAL\_INCLUDE\_FILE */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00065}00065 \textcolor{preprocessor}{\#if (\_\_FreeBSD\_version < 700000)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00066}\mbox{\hyperlink{usb__process_8c_ae13d33415fe3fb4f46469e961c565162}{00066}} \textcolor{preprocessor}{\#define thread\_lock(td) mtx\_lock\_spin(\&sched\_lock)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00067}\mbox{\hyperlink{usb__process_8c_a5545ab650f17ce078453bb164d4528f3}{00067}} \textcolor{preprocessor}{\#define thread\_unlock(td) mtx\_unlock\_spin(\&sched\_lock)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00068}00068 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00070}00070 \textcolor{preprocessor}{\#if (\_\_FreeBSD\_version >= 800000)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00071}00071 \textcolor{keyword}{static} \textcolor{keyword}{struct }proc *usbproc;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00072}00072 \textcolor{keyword}{static} \textcolor{keywordtype}{int} usb\_pcount;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00073}00073 \textcolor{preprocessor}{\#define USB\_THREAD\_CREATE(f, s, p, ...) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00074}00074 \textcolor{preprocessor}{                kproc\_kthread\_add((f), (s), \&usbproc, (p), RFHIGHPID, \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00075}00075 \textcolor{preprocessor}{                    0, "{}usb"{}}, \_\_VA\_ARGS\_\_)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00076}00076 \textcolor{preprocessor}{\#if (\_\_FreeBSD\_version >= 900000)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00077}00077 \textcolor{preprocessor}{\#define USB\_THREAD\_SUSPEND\_CHECK() kthread\_suspend\_check()}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00078}00078 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00079}00079 \textcolor{preprocessor}{\#define USB\_THREAD\_SUSPEND\_CHECK() kthread\_suspend\_check(curthread)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00080}00080 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00081}00081 \textcolor{preprocessor}{\#define USB\_THREAD\_SUSPEND(p)   kthread\_suspend(p,0)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00082}00082 \textcolor{preprocessor}{\#define USB\_THREAD\_EXIT(err)    kthread\_exit()}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00083}00083 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00084}\mbox{\hyperlink{usb__process_8c_a9429515a67400e9cbdcb54c4167dbaa0}{00084}} \textcolor{preprocessor}{\#define USB\_THREAD\_CREATE(f, s, p, ...) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00085}00085 \textcolor{preprocessor}{                kthread\_create((f), (s), (p), RFHIGHPID, 0, \_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00086}\mbox{\hyperlink{usb__process_8c_aef98bff84255c7a9e47f7d15cd774f5e}{00086}} \textcolor{preprocessor}{\#define USB\_THREAD\_SUSPEND\_CHECK() kthread\_suspend\_check(curproc)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00087}\mbox{\hyperlink{usb__process_8c_ac14909060c19048ad52708280edf47aa}{00087}} \textcolor{preprocessor}{\#define USB\_THREAD\_SUSPEND(p)   kthread\_suspend(p,0)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00088}\mbox{\hyperlink{usb__process_8c_a3bffae36225356110399c3f0cece15ca}{00088}} \textcolor{preprocessor}{\#define USB\_THREAD\_EXIT(err)    kthread\_exit(err)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00089}00089 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00090}00090 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00091}00091 \textcolor{preprocessor}{\#ifdef USB\_DEBUG}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00092}00092 \textcolor{keyword}{static} \textcolor{keywordtype}{int} usb\_proc\_debug;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00094}00094 \textcolor{keyword}{static} \mbox{\hyperlink{dwc__otg_8c_a58e125bcf985ce2333baef42f97b33b3}{SYSCTL\_NODE}}(\_hw\_usb, OID\_AUTO, proc, CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00095}00095     \textcolor{stringliteral}{"{}USB process"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00096}00096 \mbox{\hyperlink{dwc__otg_8c_a83d020f0b15dc2783f3f1a6966c75e36}{SYSCTL\_INT}}(\_hw\_usb\_proc, OID\_AUTO, \mbox{\hyperlink{cfumass_8c_ac3e1795766a80ec63b157951b4b9a7d4}{debug}}, CTLFLAG\_RWTUN, \&usb\_proc\_debug, 0,}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00097}00097     \textcolor{stringliteral}{"{}Debug level"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00098}00098 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00100}00100 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00101}00101 \textcolor{comment}{ *      usb\_process}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00102}00102 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00103}00103 \textcolor{comment}{ * This function is the USB process dispatcher.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00104}00104 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00105}00105 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00106}\mbox{\hyperlink{usb__process_8c_a63920723412fd87395b6c7ec5e89e6bf}{00106}} \mbox{\hyperlink{usb__process_8c_a63920723412fd87395b6c7ec5e89e6bf}{usb\_process}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00107}00107 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00108}00108         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__process}{usb\_process}} *up = arg;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00109}00109         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00110}00110         \textcolor{keyword}{struct }thread *td;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00111}00111 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00112}00112         \textcolor{comment}{/* in case of attach error, check for suspended */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00113}00113         \mbox{\hyperlink{usb__process_8c_aef98bff84255c7a9e47f7d15cd774f5e}{USB\_THREAD\_SUSPEND\_CHECK}}();}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00114}00114 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00115}00115         \textcolor{comment}{/* adjust priority */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00116}00116         td = curthread;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00117}00117         \mbox{\hyperlink{usb__process_8c_ae13d33415fe3fb4f46469e961c565162}{thread\_lock}}(td);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00118}00118         sched\_prio(td, up-\/>\mbox{\hyperlink{structusb__process_a9874b6f5eddb948cd003dda70433783f}{up\_prio}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00119}00119         \mbox{\hyperlink{usb__process_8c_a5545ab650f17ce078453bb164d4528f3}{thread\_unlock}}(td);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00121}00121         \mbox{\hyperlink{usbdi_8h_a356c200da9171c8f047afae5440c2a0a}{USB\_MTX\_LOCK}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00122}00122 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00123}00123         up-\/>\mbox{\hyperlink{structusb__process_a1fb695a5a4be732b8154bf776ac22dd1}{up\_curtd}} = td;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00124}00124 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00125}00125         \textcolor{keywordflow}{while} (1) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00126}00126                 \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}})}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00127}00127                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00128}00128 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00129}00129                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00130}00130 \textcolor{comment}{                 * NOTE to reimplementors: dequeueing a command from the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00131}00131 \textcolor{comment}{                 * "{}used"{} queue and executing it must be atomic, with regard}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00132}00132 \textcolor{comment}{                 * to the "{}up\_mtx"{} mutex. That means any attempt to queue a}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00133}00133 \textcolor{comment}{                 * command by another thread must be blocked until either:}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00134}00134 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00135}00135 \textcolor{comment}{                 * 1) the command sleeps}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00136}00136 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00137}00137 \textcolor{comment}{                 * 2) the command returns}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00138}00138 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00139}00139 \textcolor{comment}{                 * Here is a practical example that shows how this helps}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00140}00140 \textcolor{comment}{                 * solving a problem:}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00141}00141 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00142}00142 \textcolor{comment}{                 * Assume that you want to set the baud rate on a USB serial}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00143}00143 \textcolor{comment}{                 * device. During the programming of the device you don't}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00144}00144 \textcolor{comment}{                 * want to receive nor transmit any data, because it will be}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00145}00145 \textcolor{comment}{                 * garbage most likely anyway. The programming of our USB}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00146}00146 \textcolor{comment}{                 * device takes 20 milliseconds and it needs to call}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00147}00147 \textcolor{comment}{                 * functions that sleep.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00148}00148 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00149}00149 \textcolor{comment}{                 * Non-\/working solution: Before we queue the programming}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00150}00150 \textcolor{comment}{                 * command, we stop transmission and reception of data. Then}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00151}00151 \textcolor{comment}{                 * we queue a programming command. At the end of the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00152}00152 \textcolor{comment}{                 * programming command we enable transmission and reception}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00153}00153 \textcolor{comment}{                 * of data.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00154}00154 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00155}00155 \textcolor{comment}{                 * Problem: If a second programming command is queued while the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00156}00156 \textcolor{comment}{                 * first one is sleeping, we end up enabling transmission}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00157}00157 \textcolor{comment}{                 * and reception of data too early.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00158}00158 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00159}00159 \textcolor{comment}{                 * Working solution: Before we queue the programming command,}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00160}00160 \textcolor{comment}{                 * we stop transmission and reception of data. Then we queue}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00161}00161 \textcolor{comment}{                 * a programming command. Then we queue a second command}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00162}00162 \textcolor{comment}{                 * that only enables transmission and reception of data.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00163}00163 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00164}00164 \textcolor{comment}{                 * Why it works: If a second programming command is queued}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00165}00165 \textcolor{comment}{                 * while the first one is sleeping, then the queueing of a}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00166}00166 \textcolor{comment}{                 * second command to enable the data transfers, will cause}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00167}00167 \textcolor{comment}{                 * the previous one, which is still on the queue, to be}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00168}00168 \textcolor{comment}{                 * removed from the queue, and re-\/inserted after the last}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00169}00169 \textcolor{comment}{                 * baud rate programming command, which then gives the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00170}00170 \textcolor{comment}{                 * desired result.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00171}00171 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00172}00172                 pm = TAILQ\_FIRST(\&up-\/>up\_qhead);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00173}00173 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00174}00174                 \textcolor{keywordflow}{if} (pm) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00175}00175                         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}Message pm=\%p, cb=\%p (enter)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00176}00176                             pm, pm-\/>\mbox{\hyperlink{structusb__proc__msg_a3ef3a62c9c45df2eca4677c43eb0e1a0}{pm\_callback}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00178}00178                         (pm-\/>\mbox{\hyperlink{structusb__proc__msg_a3ef3a62c9c45df2eca4677c43eb0e1a0}{pm\_callback}}) (pm);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00179}00179 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00180}00180                         \textcolor{keywordflow}{if} (pm == TAILQ\_FIRST(\&up-\/>up\_qhead)) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00181}00181                                 \textcolor{comment}{/* nothing changed */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00182}00182                                 TAILQ\_REMOVE(\&up-\/>up\_qhead, pm, pm\_qentry);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00183}00183                                 pm-\/>pm\_qentry.tqe\_prev = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00184}00184                         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00185}00185                         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}Message pm=\%p (leave)\(\backslash\)n"{}}, pm);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00187}00187                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00188}00188                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00189}00189                 \textcolor{comment}{/* end of messages -\/ check if anyone is waiting for sync */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00190}00190                 \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_af639a04a9fe8169b6cc41d907b38c12a}{up\_dsleep}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00191}00191                         up-\/>\mbox{\hyperlink{structusb__process_af639a04a9fe8169b6cc41d907b38c12a}{up\_dsleep}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00192}00192                         cv\_broadcast(\&up-\/>\mbox{\hyperlink{structusb__process_a3f74b9318dc541232b68c8da44486b02}{up\_drain}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00193}00193                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00194}00194                 up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00195}00195                 cv\_wait(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}}, up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00196}00196         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00198}00198         up-\/>\mbox{\hyperlink{structusb__process_a7b85d136a2ffb5dd8f34039fcbfb85bf}{up\_ptr}} = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00199}00199         cv\_signal(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00200}00200         \mbox{\hyperlink{usbdi_8h_a101cc5e91f4afa03b678d8941551c4d5}{USB\_MTX\_UNLOCK}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00201}00201 \textcolor{preprocessor}{\#if (\_\_FreeBSD\_version >= 800000)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00202}00202         \textcolor{comment}{/* Clear the proc pointer if this is the last thread. */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00203}00203         \textcolor{keywordflow}{if} (-\/-\/usb\_pcount == 0)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00204}00204                 usbproc = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00205}00205 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00207}00207         \mbox{\hyperlink{usb__process_8c_a3bffae36225356110399c3f0cece15ca}{USB\_THREAD\_EXIT}}(0);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00208}00208 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00209}00209 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00210}00210 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00211}00211 \textcolor{comment}{ *      usb\_proc\_create}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00212}00212 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00213}00213 \textcolor{comment}{ * This function will create a process using the given "{}prio"{} that can}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00214}00214 \textcolor{comment}{ * execute callbacks. The mutex pointed to by "{}p\_mtx"{} will be applied}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00215}00215 \textcolor{comment}{ * before calling the callbacks and released after that the callback}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00216}00216 \textcolor{comment}{ * has returned. The structure pointed to by "{}up"{} is assumed to be}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00217}00217 \textcolor{comment}{ * zeroed before this function is called.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00218}00218 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00219}00219 \textcolor{comment}{ * Return values:}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00220}00220 \textcolor{comment}{ *    0: success}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00221}00221 \textcolor{comment}{ * Else: failure}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00222}00222 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00223}00223 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00224}\mbox{\hyperlink{usb__process_8c_a2fede49f97927cefc9f5ef7086e5c64a}{00224}} \mbox{\hyperlink{usb__process_8c_a2fede49f97927cefc9f5ef7086e5c64a}{usb\_proc\_create}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up, \textcolor{keyword}{struct} mtx *p\_mtx,}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00225}00225     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *pmesg, uint8\_t prio)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00226}00226 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00227}00227         up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} = p\_mtx;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00228}00228         up-\/>\mbox{\hyperlink{structusb__process_a9874b6f5eddb948cd003dda70433783f}{up\_prio}} = prio;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00229}00229 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00230}00230         TAILQ\_INIT(\&up-\/>up\_qhead);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00231}00231 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00232}00232         cv\_init(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}}, \textcolor{stringliteral}{"{}-\/"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00233}00233         cv\_init(\&up-\/>\mbox{\hyperlink{structusb__process_a3f74b9318dc541232b68c8da44486b02}{up\_drain}}, \textcolor{stringliteral}{"{}usbdrain"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00234}00234 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00235}00235         \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__process_8c_a9429515a67400e9cbdcb54c4167dbaa0}{USB\_THREAD\_CREATE}}(\&\mbox{\hyperlink{structusb__process}{usb\_process}}, up,}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00236}00236             \&up-\/>\mbox{\hyperlink{structusb__process_a7b85d136a2ffb5dd8f34039fcbfb85bf}{up\_ptr}}, \textcolor{stringliteral}{"{}\%s"{}}, pmesg)) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00237}00237                 DPRINTFN(0, \textcolor{stringliteral}{"{}Unable to create USB process."{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00238}00238                 up-\/>\mbox{\hyperlink{structusb__process_a7b85d136a2ffb5dd8f34039fcbfb85bf}{up\_ptr}} = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00239}00239                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00240}00240         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00241}00241 \textcolor{preprocessor}{\#if (\_\_FreeBSD\_version >= 800000)}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00242}00242         usb\_pcount++;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00243}00243 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00244}00244         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00245}00245 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00246}00246 \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}:}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00247}00247         \mbox{\hyperlink{usb__process_8c_ad6b88a1b7a14626bcfbfaef49be1dceb}{usb\_proc\_free}}(up);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00248}00248         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00249}00249 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00251}00251 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00252}00252 \textcolor{comment}{ *      usb\_proc\_free}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00253}00253 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00254}00254 \textcolor{comment}{ * NOTE: If the structure pointed to by "{}up"{} is all zero, this}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00255}00255 \textcolor{comment}{ * function does nothing.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00256}00256 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00257}00257 \textcolor{comment}{ * NOTE: Messages that are pending on the process queue will not be}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00258}00258 \textcolor{comment}{ * removed nor called.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00259}00259 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00260}00260 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00261}\mbox{\hyperlink{usb__process_8c_ad6b88a1b7a14626bcfbfaef49be1dceb}{00261}} \mbox{\hyperlink{usb__process_8c_ad6b88a1b7a14626bcfbfaef49be1dceb}{usb\_proc\_free}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00262}00262 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00263}00263         \textcolor{comment}{/* check if not initialised */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00264}00264         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} == NULL)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00265}00265                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00266}00266 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00267}00267         \mbox{\hyperlink{usb__process_8c_a6a9d8fe536d20afd846c2a3d1a03271d}{usb\_proc\_drain}}(up);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00269}00269         cv\_destroy(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00270}00270         cv\_destroy(\&up-\/>\mbox{\hyperlink{structusb__process_a3f74b9318dc541232b68c8da44486b02}{up\_drain}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00271}00271 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00272}00272         \textcolor{comment}{/* make sure that we do not enter here again */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00273}00273         up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00274}00274 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00275}00275 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00276}00276 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00277}00277 \textcolor{comment}{ *      usb\_proc\_msignal}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00278}00278 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00279}00279 \textcolor{comment}{ * This function will queue one of the passed USB process messages on}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00280}00280 \textcolor{comment}{ * the USB process queue. The first message that is not already queued}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00281}00281 \textcolor{comment}{ * will get queued. If both messages are already queued the one queued}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00282}00282 \textcolor{comment}{ * last will be removed from the queue and queued in the end. The USB}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00283}00283 \textcolor{comment}{ * process mutex must be locked when calling this function. This}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00284}00284 \textcolor{comment}{ * function exploits the fact that a process can only do one callback}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00285}00285 \textcolor{comment}{ * at a time. The message that was queued is returned.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00286}00286 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00287}00287 \textcolor{keywordtype}{void}   *}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00288}\mbox{\hyperlink{usb__process_8c_a9815bfac5c88a8f483a16eebe010bfc7}{00288}} \mbox{\hyperlink{usb__process_8c_a9815bfac5c88a8f483a16eebe010bfc7}{usb\_proc\_msignal}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up, \textcolor{keywordtype}{void} *\_pm0, \textcolor{keywordtype}{void} *\_pm1)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00289}00289 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00290}00290         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm0 = \_pm0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00291}00291         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm1 = \_pm1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00292}00292         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm2;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00293}00293         \mbox{\hyperlink{usb__freebsd_8h_aef76bd5158b84c44681a07bc5f22aff1}{usb\_size\_t}} d;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00294}00294         uint8\_t t;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00296}00296         \textcolor{comment}{/* check if gone or in polling mode, return dummy value */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00297}00297         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}} != 0 ||}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00298}00298             \mbox{\hyperlink{usb__freebsd_8h_ae4dbc653d4ae9493b40a9485fc0ecf23}{USB\_IN\_POLLING\_MODE\_FUNC}}() != 0)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00299}00299                 \textcolor{keywordflow}{return} (\_pm0);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00300}00300 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00301}00301         \mbox{\hyperlink{usbdi_8h_a107993503e7d0b7e1178eddef27e57a9}{USB\_MTX\_ASSERT}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00302}00302 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00303}00303         t = 0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00305}00305         \textcolor{keywordflow}{if} (pm0-\/>pm\_qentry.tqe\_prev) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00306}00306                 t |= 1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00307}00307         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00308}00308         \textcolor{keywordflow}{if} (pm1-\/>pm\_qentry.tqe\_prev) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00309}00309                 t |= 2;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00310}00310         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00311}00311         \textcolor{keywordflow}{if} (t == 0) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00312}00312                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00313}00313 \textcolor{comment}{                 * No entries are queued. Queue "{}pm0"{} and use the existing}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00314}00314 \textcolor{comment}{                 * message number.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00315}00315 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00316}00316                 pm2 = pm0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00317}00317         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (t == 1) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00318}00318                 \textcolor{comment}{/* Check if we need to increment the message number. */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00319}00319                 \textcolor{keywordflow}{if} (pm0-\/>\mbox{\hyperlink{structusb__proc__msg_a36eddec232ee31ff71b5aa38128cd447}{pm\_num}} == up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00320}00320                         up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}}++;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00321}00321                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00322}00322                 pm2 = pm1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00323}00323         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (t == 2) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00324}00324                 \textcolor{comment}{/* Check if we need to increment the message number. */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00325}00325                 \textcolor{keywordflow}{if} (pm1-\/>\mbox{\hyperlink{structusb__proc__msg_a36eddec232ee31ff71b5aa38128cd447}{pm\_num}} == up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00326}00326                         up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}}++;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00327}00327                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00328}00328                 pm2 = pm0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00329}00329         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (t == 3) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00330}00330                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00331}00331 \textcolor{comment}{                 * Both entries are queued. Re-\/queue the entry closest to}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00332}00332 \textcolor{comment}{                 * the end.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00333}00333 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00334}00334                 d = (pm1-\/>\mbox{\hyperlink{structusb__proc__msg_a36eddec232ee31ff71b5aa38128cd447}{pm\_num}} -\/ pm0-\/>\mbox{\hyperlink{structusb__proc__msg_a36eddec232ee31ff71b5aa38128cd447}{pm\_num}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00335}00335 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00336}00336                 \textcolor{comment}{/* Check sign after subtraction */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00337}00337                 \textcolor{keywordflow}{if} (d \& 0x80000000) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00338}00338                         pm2 = pm0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00339}00339                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00340}00340                         pm2 = pm1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00341}00341                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00343}00343                 TAILQ\_REMOVE(\&up-\/>up\_qhead, pm2, pm\_qentry);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00344}00344         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00345}00345                 pm2 = NULL;             \textcolor{comment}{/* panic -\/ should not happen */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00346}00346         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00347}00347 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00348}00348         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{} t=\%u, num=\%u\(\backslash\)n"{}}, t, up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00349}00349 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00350}00350         \textcolor{comment}{/* Put message last on queue */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00351}00351 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00352}00352         pm2-\/>\mbox{\hyperlink{structusb__proc__msg_a36eddec232ee31ff71b5aa38128cd447}{pm\_num}} = up-\/>\mbox{\hyperlink{structusb__process_a7ff11a68f1cc0ed333fba06492f239a3}{up\_msg\_num}};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00353}00353         TAILQ\_INSERT\_TAIL(\&up-\/>up\_qhead, pm2, pm\_qentry);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00354}00354 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00355}00355         \textcolor{comment}{/* Check if we need to wakeup the USB process. */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00356}00356 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00357}00357         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00358}00358                 up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}} = 0;     \textcolor{comment}{/* save "{}cv\_signal()"{} calls */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00359}00359                 cv\_signal(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00360}00360         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00361}00361         \textcolor{keywordflow}{return} (pm2);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00362}00362 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00363}00363 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00364}00364 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00365}00365 \textcolor{comment}{ *      usb\_proc\_is\_gone}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00366}00366 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00367}00367 \textcolor{comment}{ * Return values:}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00368}00368 \textcolor{comment}{ *    0: USB process is running}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00369}00369 \textcolor{comment}{ * Else: USB process is tearing down}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00370}00370 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00371}00371 uint8\_t}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00372}\mbox{\hyperlink{usb__process_8c_a3e99469b3a5a6ba509a46283e7e23d0c}{00372}} \mbox{\hyperlink{usb__process_8c_a3e99469b3a5a6ba509a46283e7e23d0c}{usb\_proc\_is\_gone}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00373}00373 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00374}00374         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}})}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00375}00375                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00376}00376 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00377}00377         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00378}00378 \textcolor{comment}{         * Allow calls when up\_mtx is NULL, before the USB process}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00379}00379 \textcolor{comment}{         * structure is initialised.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00380}00380 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00381}00381         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} != NULL)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00382}00382                 \mbox{\hyperlink{usbdi_8h_a107993503e7d0b7e1178eddef27e57a9}{USB\_MTX\_ASSERT}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00383}00383         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00384}00384 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00385}00385 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00386}00386 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00387}00387 \textcolor{comment}{ *      usb\_proc\_mwait}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00388}00388 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00389}00389 \textcolor{comment}{ * This function will return when the USB process message pointed to}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00390}00390 \textcolor{comment}{ * by "{}pm"{} is no longer on a queue. This function must be called}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00391}00391 \textcolor{comment}{ * having "{}up-\/>up\_mtx"{} locked.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00392}00392 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00393}00393 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00394}\mbox{\hyperlink{usb__process_8c_a4d67f190e5699975c92e3de84f5e84f1}{00394}} \mbox{\hyperlink{usb__process_8c_a4d67f190e5699975c92e3de84f5e84f1}{usb\_proc\_mwait}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up, \textcolor{keywordtype}{void} *\_pm0, \textcolor{keywordtype}{void} *\_pm1)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00395}00395 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00396}00396         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm0 = \_pm0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00397}00397         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__proc__msg}{usb\_proc\_msg}} *pm1 = \_pm1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00398}00398 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00399}00399         \textcolor{comment}{/* check if gone */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00400}00400         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}})}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00401}00401                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00402}00402 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00403}00403         \mbox{\hyperlink{usbdi_8h_a107993503e7d0b7e1178eddef27e57a9}{USB\_MTX\_ASSERT}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00405}00405         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a1fb695a5a4be732b8154bf776ac22dd1}{up\_curtd}} == curthread) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00406}00406                 \textcolor{comment}{/* Just remove the messages from the queue. */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00407}00407                 \textcolor{keywordflow}{if} (pm0-\/>pm\_qentry.tqe\_prev) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00408}00408                         TAILQ\_REMOVE(\&up-\/>up\_qhead, pm0, pm\_qentry);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00409}00409                         pm0-\/>pm\_qentry.tqe\_prev = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00410}00410                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00411}00411                 \textcolor{keywordflow}{if} (pm1-\/>pm\_qentry.tqe\_prev) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00412}00412                         TAILQ\_REMOVE(\&up-\/>up\_qhead, pm1, pm\_qentry);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00413}00413                         pm1-\/>pm\_qentry.tqe\_prev = NULL;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00414}00414                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00415}00415         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00416}00416                 \textcolor{keywordflow}{while} (pm0-\/>pm\_qentry.tqe\_prev ||}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00417}00417                     pm1-\/>pm\_qentry.tqe\_prev) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00418}00418                         \textcolor{comment}{/* check if config thread is gone */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00419}00419                         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}})}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00420}00420                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00421}00421                         up-\/>\mbox{\hyperlink{structusb__process_af639a04a9fe8169b6cc41d907b38c12a}{up\_dsleep}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00422}00422                         cv\_wait(\&up-\/>\mbox{\hyperlink{structusb__process_a3f74b9318dc541232b68c8da44486b02}{up\_drain}}, up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00423}00423                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00424}00424 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00426}00426 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00427}00427 \textcolor{comment}{ *      usb\_proc\_drain}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00428}00428 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00429}00429 \textcolor{comment}{ * This function will tear down an USB process, waiting for the}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00430}00430 \textcolor{comment}{ * currently executing command to return.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00431}00431 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00432}00432 \textcolor{comment}{ * NOTE: If the structure pointed to by "{}up"{} is all zero,}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00433}00433 \textcolor{comment}{ * this function does nothing.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00434}00434 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00435}00435 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00436}\mbox{\hyperlink{usb__process_8c_a6a9d8fe536d20afd846c2a3d1a03271d}{00436}} \mbox{\hyperlink{usb__process_8c_a6a9d8fe536d20afd846c2a3d1a03271d}{usb\_proc\_drain}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00437}00437 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00438}00438         \textcolor{comment}{/* check if not initialised */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00439}00439         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} == NULL)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00440}00440                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00441}00441         \textcolor{comment}{/* handle special case with Giant */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00442}00442         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} != \&Giant)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00443}00443                 \mbox{\hyperlink{usbdi_8h_a107993503e7d0b7e1178eddef27e57a9}{USB\_MTX\_ASSERT}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}}, MA\_NOTOWNED);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00444}00444 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00445}00445         \mbox{\hyperlink{usbdi_8h_a356c200da9171c8f047afae5440c2a0a}{USB\_MTX\_LOCK}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00446}00446 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00447}00447         \textcolor{comment}{/* Set the gone flag */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00448}00448 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00449}00449         up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00451}00451         \textcolor{keywordflow}{while} (up-\/>\mbox{\hyperlink{structusb__process_a7b85d136a2ffb5dd8f34039fcbfb85bf}{up\_ptr}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00452}00452                 \textcolor{comment}{/* Check if we need to wakeup the USB process */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00453}00453 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00454}00454                 \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}} || up-\/>\mbox{\hyperlink{structusb__process_aeaf6faba8bb44fa9fe1edb59f0c194fd}{up\_csleep}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00455}00455                         up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00456}00456                         up-\/>\mbox{\hyperlink{structusb__process_aeaf6faba8bb44fa9fe1edb59f0c194fd}{up\_csleep}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00457}00457                         cv\_signal(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00458}00458                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00459}00459 \textcolor{preprocessor}{\#ifndef EARLY\_AP\_STARTUP}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00460}00460                 \textcolor{comment}{/* Check if we are still cold booted */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00461}00461                 \textcolor{keywordflow}{if} (cold) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00462}00462                         \mbox{\hyperlink{usb__process_8c_ac14909060c19048ad52708280edf47aa}{USB\_THREAD\_SUSPEND}}(up-\/>\mbox{\hyperlink{structusb__process_a7b85d136a2ffb5dd8f34039fcbfb85bf}{up\_ptr}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00463}00463                         printf(\textcolor{stringliteral}{"{}WARNING: A USB process has "{}}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00464}00464                             \textcolor{stringliteral}{"{}been left suspended\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00465}00465                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00466}00466                 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00467}00467 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00468}00468                 cv\_wait(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}}, up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00469}00469         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00470}00470         \textcolor{comment}{/* Check if someone is waiting -\/ should not happen */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00471}00471 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00472}00472         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_af639a04a9fe8169b6cc41d907b38c12a}{up\_dsleep}}) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00473}00473                 up-\/>\mbox{\hyperlink{structusb__process_af639a04a9fe8169b6cc41d907b38c12a}{up\_dsleep}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00474}00474                 cv\_broadcast(\&up-\/>\mbox{\hyperlink{structusb__process_a3f74b9318dc541232b68c8da44486b02}{up\_drain}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00475}00475                 \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}WARNING: Someone is waiting "{}}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00476}00476                     \textcolor{stringliteral}{"{}for USB process drain!\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00477}00477         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00478}00478         \mbox{\hyperlink{usbdi_8h_a101cc5e91f4afa03b678d8941551c4d5}{USB\_MTX\_UNLOCK}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00479}00479 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00480}00480 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00481}00481 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00482}00482 \textcolor{comment}{ *      usb\_proc\_rewakeup}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00483}00483 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00484}00484 \textcolor{comment}{ * This function is called to re-\/wakeup the given USB}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00485}00485 \textcolor{comment}{ * process. This usually happens after that the USB system has been in}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00486}00486 \textcolor{comment}{ * polling mode, like during a panic. This function must be called}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00487}00487 \textcolor{comment}{ * having "{}up-\/>up\_mtx"{} locked.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00488}00488 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00489}00489 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00490}\mbox{\hyperlink{usb__process_8c_acf0fd4d71dc810720b18e0eb503ec970}{00490}} \mbox{\hyperlink{usb__process_8c_acf0fd4d71dc810720b18e0eb503ec970}{usb\_proc\_rewakeup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00491}00491 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00492}00492         \textcolor{comment}{/* check if not initialised */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00493}00493         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}} == NULL)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00494}00494                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00495}00495         \textcolor{comment}{/* check if gone */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00496}00496         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_acf18fad7abc481a352e7b831a64501e7}{up\_gone}})}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00497}00497                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00498}00498 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00499}00499         \mbox{\hyperlink{usbdi_8h_a107993503e7d0b7e1178eddef27e57a9}{USB\_MTX\_ASSERT}}(up-\/>\mbox{\hyperlink{structusb__process_a9fe9afd3c32e9d5ddfc4309a92a07f53}{up\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00501}00501         \textcolor{keywordflow}{if} (up-\/>\mbox{\hyperlink{structusb__process_ae6c052fd31fa3396d09690a640dc86d6}{up\_msleep}} == 0) \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00502}00502                 \textcolor{comment}{/* re-\/wakeup */}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00503}00503                 cv\_signal(\&up-\/>\mbox{\hyperlink{structusb__process_aaaf54a315be35c74f9b49d9848582264}{up\_cv}});}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00504}00504         \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00505}00505 \}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00506}00506 }
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00507}00507 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00508}00508 \textcolor{comment}{ *      usb\_proc\_is\_called\_from}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00509}00509 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00510}00510 \textcolor{comment}{ * This function will return non-\/zero if called from inside the USB}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00511}00511 \textcolor{comment}{ * process passed as first argument. Else this function returns zero.}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00512}00512 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00513}00513 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00514}\mbox{\hyperlink{usb__process_8c_a9121f955bdf8dec1dd98b0f617f869fb}{00514}} \mbox{\hyperlink{usb__process_8c_a9121f955bdf8dec1dd98b0f617f869fb}{usb\_proc\_is\_called\_from}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__process}{usb\_process}} *up)}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00515}00515 \{}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00516}00516         \textcolor{keywordflow}{return} (up-\/>\mbox{\hyperlink{structusb__process_a1fb695a5a4be732b8154bf776ac22dd1}{up\_curtd}} == curthread);}
\DoxyCodeLine{\Hypertarget{usb__process_8c_source_l00517}00517 \}}

\end{DoxyCode}
