\hypertarget{usb__mbuf_8h_source}{}\doxysection{usb\+\_\+mbuf.\+h}
\label{usb__mbuf_8h_source}\index{dev/usb/usb\_mbuf.h@{dev/usb/usb\_mbuf.h}}
\mbox{\hyperlink{usb__mbuf_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00001}00001 \textcolor{comment}{/* \$FreeBSD\$ */}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00002}00002 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00003}00003 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00029}00029 \textcolor{preprocessor}{\#ifndef \_USB\_MBUF\_H\_}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00030}00030 \textcolor{preprocessor}{\#define \_USB\_MBUF\_H\_}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00032}00032 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00033}00033 \textcolor{comment}{ * The following structure defines a minimum re-\/implementation of the}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00034}00034 \textcolor{comment}{ * mbuf system in the kernel.}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00035}00035 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00036}\mbox{\hyperlink{structusb__mbuf}{00036}} \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__mbuf}{usb\_mbuf}} \{}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00037}\mbox{\hyperlink{structusb__mbuf_a266a505a5ba6191e526bbba0da412836}{00037}}         uint8\_t *\mbox{\hyperlink{structusb__mbuf_a266a505a5ba6191e526bbba0da412836}{cur\_data\_ptr}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00038}\mbox{\hyperlink{structusb__mbuf_a2982f0f907e29bba9c80dc3e0bb1d7df}{00038}}         uint8\_t *\mbox{\hyperlink{structusb__mbuf_a2982f0f907e29bba9c80dc3e0bb1d7df}{min\_data\_ptr}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00039}\mbox{\hyperlink{structusb__mbuf_ab4826579ce3128ad3d41885996bccdb0}{00039}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__mbuf}{usb\_mbuf}} *\mbox{\hyperlink{structusb__mbuf_ab4826579ce3128ad3d41885996bccdb0}{usb\_nextpkt}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00040}\mbox{\hyperlink{structusb__mbuf_ab8e4f97aa6902ec72b81a7b4e3d430b2}{00040}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__mbuf}{usb\_mbuf}} *\mbox{\hyperlink{structusb__mbuf_ab8e4f97aa6902ec72b81a7b4e3d430b2}{usb\_next}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00042}\mbox{\hyperlink{structusb__mbuf_af413f80b0ab6d0d2cd9d97f21237fb3e}{00042}}         \mbox{\hyperlink{usb__freebsd_8h_aef76bd5158b84c44681a07bc5f22aff1}{usb\_size\_t}} \mbox{\hyperlink{structusb__mbuf_af413f80b0ab6d0d2cd9d97f21237fb3e}{cur\_data\_len}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00043}\mbox{\hyperlink{structusb__mbuf_af2184ebabf2803f6ae5f9aadafbbf833}{00043}}         \mbox{\hyperlink{usb__freebsd_8h_aef76bd5158b84c44681a07bc5f22aff1}{usb\_size\_t}} \mbox{\hyperlink{structusb__mbuf_af2184ebabf2803f6ae5f9aadafbbf833}{max\_data\_len}};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00044}\mbox{\hyperlink{structusb__mbuf_a1120fe893fcae0fc314fafc4e644a565}{00044}}         uint8\_t \mbox{\hyperlink{structusb__mbuf_a1120fe893fcae0fc314fafc4e644a565}{last\_packet}}:1;}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00045}\mbox{\hyperlink{structusb__mbuf_a06273fde67cc42cd768ae9c5a3939805}{00045}}         uint8\_t \mbox{\hyperlink{structusb__mbuf_a06273fde67cc42cd768ae9c5a3939805}{unused}}:7;}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00046}00046 \};}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00048}\mbox{\hyperlink{usb__mbuf_8h_a687851a62f15d69c340d6d93268c6686}{00048}} \textcolor{preprocessor}{\#define USB\_IF\_ENQUEUE(ifq, m) do \{             \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00049}00049 \textcolor{preprocessor}{    (m)-\/>usb\_nextpkt = NULL;                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00050}00050 \textcolor{preprocessor}{    if ((ifq)-\/>ifq\_tail == NULL)                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00051}00051 \textcolor{preprocessor}{        (ifq)-\/>ifq\_head = (m);                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00052}00052 \textcolor{preprocessor}{    else                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00053}00053 \textcolor{preprocessor}{        (ifq)-\/>ifq\_tail-\/>usb\_nextpkt = (m);     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00054}00054 \textcolor{preprocessor}{    (ifq)-\/>ifq\_tail = (m);                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00055}00055 \textcolor{preprocessor}{    (ifq)-\/>ifq\_len++;                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00056}00056 \textcolor{preprocessor}{  \} while (0)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00058}\mbox{\hyperlink{usb__mbuf_8h_a05824e25e4f99a7aa338aac63b791228}{00058}} \textcolor{preprocessor}{\#define USB\_IF\_DEQUEUE(ifq, m) do \{                             \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00059}00059 \textcolor{preprocessor}{    (m) = (ifq)-\/>ifq\_head;                                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00060}00060 \textcolor{preprocessor}{    if (m) \{                                                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00061}00061 \textcolor{preprocessor}{        if (((ifq)-\/>ifq\_head = (m)-\/>usb\_nextpkt) == NULL) \{     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00062}00062 \textcolor{preprocessor}{             (ifq)-\/>ifq\_tail = NULL;                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00063}00063 \textcolor{preprocessor}{        \}                                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00064}00064 \textcolor{preprocessor}{        (m)-\/>usb\_nextpkt = NULL;                                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00065}00065 \textcolor{preprocessor}{        (ifq)-\/>ifq\_len-\/-\/;                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00066}00066 \textcolor{preprocessor}{    \}                                                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00067}00067 \textcolor{preprocessor}{  \} while (0)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00069}\mbox{\hyperlink{usb__mbuf_8h_afe71f7a3e1cf0d6aa22cec95b87ee25a}{00069}} \textcolor{preprocessor}{\#define USB\_IF\_PREPEND(ifq, m) do \{             \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00070}00070 \textcolor{preprocessor}{      (m)-\/>usb\_nextpkt = (ifq)-\/>ifq\_head;       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00071}00071 \textcolor{preprocessor}{      if ((ifq)-\/>ifq\_tail == NULL) \{            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00072}00072 \textcolor{preprocessor}{          (ifq)-\/>ifq\_tail = (m);                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00073}00073 \textcolor{preprocessor}{      \}                                         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00074}00074 \textcolor{preprocessor}{      (ifq)-\/>ifq\_head = (m);                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00075}00075 \textcolor{preprocessor}{      (ifq)-\/>ifq\_len++;                         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00076}00076 \textcolor{preprocessor}{  \} while (0)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00078}\mbox{\hyperlink{usb__mbuf_8h_a862a37f19db20124bcf1cc53566415c5}{00078}} \textcolor{preprocessor}{\#define USB\_IF\_QFULL(ifq)   ((ifq)-\/>ifq\_len >= (ifq)-\/>ifq\_maxlen)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00079}\mbox{\hyperlink{usb__mbuf_8h_a69f672f058b6f1ad869a2f17ddf52244}{00079}} \textcolor{preprocessor}{\#define USB\_IF\_QLEN(ifq)    ((ifq)-\/>ifq\_len)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00080}\mbox{\hyperlink{usb__mbuf_8h_aecac921b8969038d1c59ae2e3f6f85de}{00080}} \textcolor{preprocessor}{\#define USB\_IF\_POLL(ifq, m) ((m) = (ifq)-\/>ifq\_head)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00082}\mbox{\hyperlink{usb__mbuf_8h_aae21720dd72f4585350149ec7f0b8543}{00082}} \textcolor{preprocessor}{\#define USB\_MBUF\_RESET(m) do \{                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00083}00083 \textcolor{preprocessor}{    (m)-\/>cur\_data\_ptr = (m)-\/>min\_data\_ptr;      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00084}00084 \textcolor{preprocessor}{    (m)-\/>cur\_data\_len = (m)-\/>max\_data\_len;      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00085}00085 \textcolor{preprocessor}{    (m)-\/>last\_packet = 0;                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00086}00086 \textcolor{preprocessor}{  \} while (0)}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00087}00087 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00088}00088 \textcolor{comment}{/* prototypes */}}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00089}00089 \textcolor{keywordtype}{void}   *\mbox{\hyperlink{usb__mbuf_8h_a956d7e2ac8bfec14073b3ffdceae89ec}{usb\_alloc\_mbufs}}(\textcolor{keyword}{struct} malloc\_type *type, \textcolor{keyword}{struct} \mbox{\hyperlink{structusb__ifqueue}{usb\_ifqueue}} *ifq,}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00090}00090             \mbox{\hyperlink{usb__freebsd_8h_aef76bd5158b84c44681a07bc5f22aff1}{usb\_size\_t}} block\_size, uint16\_t nblocks);}
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{usb__mbuf_8h_source_l00092}00092 \textcolor{preprocessor}{\#endif                                  }\textcolor{comment}{/* \_USB\_MBUF\_H\_ */}\textcolor{preprocessor}{}}

\end{DoxyCode}
