\hypertarget{ng__hci__ulpi_8c_source}{}\doxysection{ng\+\_\+hci\+\_\+ulpi.\+c}
\label{ng__hci__ulpi_8c_source}\index{netgraph/bluetooth/hci/ng\_hci\_ulpi.c@{netgraph/bluetooth/hci/ng\_hci\_ulpi.c}}
\mbox{\hyperlink{ng__hci__ulpi_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00002}00002 \textcolor{comment}{ * ng\_hci\_ulpi.c}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00006}00006 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00008}00008 \textcolor{comment}{ * Copyright (c) Maksim Yevmenkin <m\_evmenkin@yahoo.com>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00009}00009 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00011}00011 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00012}00012 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00013}00013 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00014}00014 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00016}00016 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00017}00017 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00018}00018 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00019}00019 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00021}00021 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00022}00022 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00023}00023 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00024}00024 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00025}00025 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00026}00026 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00027}00027 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00028}00028 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00029}00029 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00030}00030 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00032}00032 \textcolor{comment}{ * \$Id: ng\_hci\_ulpi.c,v 1.7 2003/09/08 18:57:51 max Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00033}00033 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00034}00034 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__bluetooth_8h}{netgraph/bluetooth/include/ng\_bluetooth.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci_8h}{netgraph/bluetooth/include/ng\_hci.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__var_8h}{netgraph/bluetooth/hci/ng\_hci\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__cmds_8h}{netgraph/bluetooth/hci/ng\_hci\_cmds.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__evnt_8h}{netgraph/bluetooth/hci/ng\_hci\_evnt.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__ulpi_8h}{netgraph/bluetooth/hci/ng\_hci\_ulpi.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__misc_8h}{netgraph/bluetooth/hci/ng\_hci\_misc.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00052}00052 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00053}00053 \textcolor{comment}{/******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00054}00054 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00055}00055 \textcolor{comment}{ **                 Upper Layer Protocol Interface module}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00056}00056 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00057}00057 \textcolor{comment}{ ******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00059}00059 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__hci__ulpi_8c_a2dedd046ef1ab8eb9e16be7e5a2c80d1}{ng\_hci\_lp\_acl\_con\_req}} (\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}, \mbox{\hyperlink{structng__item}{item\_p}}, \mbox{\hyperlink{structng__hook}{hook\_p}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00060}00060 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__hci__ulpi_8c_a201d8affabec185f784c9e4d1383c919}{ng\_hci\_lp\_sco\_con\_req}} (\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}, \mbox{\hyperlink{structng__item}{item\_p}}, \mbox{\hyperlink{structng__hook}{hook\_p}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00061}00061 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__hci__ulpi_8c_acec66d0b12281a322a618b550af8032c}{ng\_hci\_lp\_le\_con\_req}} (\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}, \mbox{\hyperlink{structng__item}{item\_p}}, \mbox{\hyperlink{structng__hook}{hook\_p}}, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00063}00063 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00064}00064 \textcolor{comment}{ * Process LP\_ConnectReq event from the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00065}00065 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00067}00067 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00068}\mbox{\hyperlink{ng__hci__ulpi_8c_af5f14a38e3a50935c9c8537b590ceb94}{00068}} \mbox{\hyperlink{ng__hci__ulpi_8c_af5f14a38e3a50935c9c8537b590ceb94}{ng\_hci\_lp\_con\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00069}00069 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00070}00070         \textcolor{keywordtype}{int} link\_type;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00072}00072         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) != \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00073}00073                 \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00074}00074 \textcolor{stringliteral}{"{}\%s: \%s -\/ unit is not ready, state=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00075}00075                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00076}00076 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00077}00077                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00079}00079                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00080}00080         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00082}00082         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen != \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00083}00083                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00084}00084 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid LP\_ConnectReq message size=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00085}00085                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00086}00086                         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00087}00087 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00088}00088                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00089}00089 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00090}00090                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00091}00091         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00092}00092         link\_type = ((\mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data))-\/>link\_type;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00093}00093         \textcolor{keywordflow}{switch}(link\_type)\{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00094}00094         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00095}00095                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__hci__ulpi_8c_a2dedd046ef1ab8eb9e16be7e5a2c80d1}{ng\_hci\_lp\_acl\_con\_req}}(unit, item, hook));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00096}00096         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00097}00097                 \textcolor{keywordflow}{if} (hook != unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}} ) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00098}00098                         \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00099}00099                                 \textcolor{stringliteral}{"{}\%s: \%s -\/ LP\_ConnectReq for SCO connection came from wrong hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00100}00100                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00101}00101                         }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00102}00102                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00103}00103                         }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00104}00104                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00105}00105                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00106}00106                 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00107}00107                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__hci__ulpi_8c_a201d8affabec185f784c9e4d1383c919}{ng\_hci\_lp\_sco\_con\_req}}(unit, item, hook));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00108}00108         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_afecc38805812b20f02942504b17892f4}{NG\_HCI\_LINK\_LE\_PUBLIC}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00109}00109         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a557665f3f28bb33759ed8ec4eb28d385}{NG\_HCI\_LINK\_LE\_RANDOM}}:                }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00110}00110                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__hci__ulpi_8c_acec66d0b12281a322a618b550af8032c}{ng\_hci\_lp\_le\_con\_req}}(unit, item, hook, link\_type));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00111}00111         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00112}00112                 panic(\textcolor{stringliteral}{"{}\%s: link\_type invalid."{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00113}00113         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00114}00114 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00115}00115         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00116}00116 \} \textcolor{comment}{/* ng\_hci\_lp\_con\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00118}00118 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00119}00119 \textcolor{comment}{ * Request to create new ACL connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00120}00120 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00122}00122 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00123}\mbox{\hyperlink{ng__hci__ulpi_8c_a2dedd046ef1ab8eb9e16be7e5a2c80d1}{00123}} \mbox{\hyperlink{ng__hci__ulpi_8c_a2dedd046ef1ab8eb9e16be7e5a2c80d1}{ng\_hci\_lp\_acl\_con\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00124}00124 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00125}00125         \textcolor{keyword}{struct }acl\_con\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00126}00126                 ng\_hci\_cmd\_pkt\_t         hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00127}00127                 ng\_hci\_create\_con\_cp     cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00128}00128         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed)) *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00129}00129         \mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}}                *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00130}00130         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}               con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00131}00131         \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_t}}              *n = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00132}00132         \textcolor{keyword}{struct }mbuf                     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00133}00133         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00134}00134 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00135}00135         ep = (\mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00137}00137         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00138}00138 \textcolor{comment}{         * Only one ACL connection can exist between each pair of units.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00139}00139 \textcolor{comment}{         * So try to find ACL connection descriptor (in any state) that}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00140}00140 \textcolor{comment}{         * has requested remote BD\_ADDR.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00141}00141 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00142}00142 \textcolor{comment}{         * Two cases:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00143}00143 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00144}00144 \textcolor{comment}{         * 1) We do not have connection to the remote unit. This is simple.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00145}00145 \textcolor{comment}{         *    Just create new connection descriptor and send HCI command to}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00146}00146 \textcolor{comment}{         *    create new connection.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00147}00147 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00148}00148 \textcolor{comment}{         * 2) We do have connection descriptor. We need to check connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00149}00149 \textcolor{comment}{         *    state:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00150}00150 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00151}00151 \textcolor{comment}{         * 2.1) NG\_HCI\_CON\_W4\_LP\_CON\_RSP means that we are in the middle of}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00152}00152 \textcolor{comment}{         *      accepting connection from the remote unit. This is a race}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00153}00153 \textcolor{comment}{         *      condition. We will ignore this message.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00154}00154 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00155}00155 \textcolor{comment}{         * 2.2) NG\_HCI\_CON\_W4\_CONN\_COMPLETE means that upper layer already}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00156}00156 \textcolor{comment}{         *      requested connection or we just accepted it. In any case}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00157}00157 \textcolor{comment}{         *      all we need to do here is set appropriate notification bit}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00158}00158 \textcolor{comment}{         *      and wait.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00159}00159 \textcolor{comment}{         *      }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00160}00160 \textcolor{comment}{         * 2.3) NG\_HCI\_CON\_OPEN means connection is open. Just reply back}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00161}00161 \textcolor{comment}{         *      and let upper layer know that we have connection already.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00162}00162 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00163}00163 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00164}00164         con = \mbox{\hyperlink{ng__hci__misc_8c_ad9bc4055b9ba79cb181bd3b6ddf1e500}{ng\_hci\_con\_by\_bdaddr}}(unit, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00165}00165         \textcolor{keywordflow}{if} (con != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00166}00166                 \textcolor{keywordflow}{switch} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00167}00167                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}}: \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00168}00168                         error = EALREADY;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00169}00169                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00170}00170 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00171}00171                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00172}00172                         \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00173}00173                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00174}00174                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00175}00175                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00176}00176                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00178}00178                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a03025e63063d215be152dd1f8b86f199}{NG\_HCI\_CON\_OPEN}}: \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00179}00179                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00180}00180                         \mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}}        *cfm = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00181}00181 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00182}00182                         \textcolor{keywordflow}{if} (hook != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(hook)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00183}00183                                 \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00184}00184                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00185}00185 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00186}00186                                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00187}00187                                         \mbox{\hyperlink{ng__hci_8h_a9aef59b1ef1df1d8613c3aea5fe9f6f1}{NGM\_HCI\_LP\_CON\_CFM}}, \textcolor{keyword}{sizeof}(*cfm), }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00188}00188                                         M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00189}00189                                 \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00190}00190                                         cfm = (\mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00191}00191                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_af1a6707b98c4fbf873960d6fa082896e}{status}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00192}00192                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_a73392be13c53de03cb2c11e311d3957e}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00193}00193                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aaf2a9d9cffcbf4b8ec30a3cbfb77cfec}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00194}00194                                         bcopy(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00195}00195                                                 \textcolor{keyword}{sizeof}(cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00197}00197                                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00198}00198 \textcolor{comment}{                                         * This will forward item back to}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00199}00199 \textcolor{comment}{                                         * sender and set item to NULL}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00200}00200 \textcolor{comment}{                                         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00202}00202                                         \mbox{\hyperlink{netgraph_8h_a2e08902bb82fa382275ab4aef2cda802}{\_NGI\_MSG}}(item) = msg;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00203}00203                                         \mbox{\hyperlink{netgraph_8h_a52b448e5f7440d396bb16d481af55b64}{NG\_FWD\_ITEM\_HOOK}}(error, item, hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00204}00204                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00205}00205                                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00206}00206                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00207}00207                                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00208}00208 \textcolor{stringliteral}{"{}\%s: \%s -\/ Source hook is not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00209}00209                                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00210}00210                                         hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00211}00211                         \} \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00212}00212 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00213}00213                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00214}00214                         panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00215}00215 \textcolor{stringliteral}{"{}\%s: \%s -\/ Invalid connection state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00216}00216                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00217}00217                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00218}00218                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00219}00219 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00220}00220                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00221}00221         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00222}00222 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00223}00223         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00224}00224 \textcolor{comment}{         * If we got here then we need to create new ACL connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00225}00225 \textcolor{comment}{         * and submit HCI command. First create new connection desriptor, set}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00226}00226 \textcolor{comment}{         * bdaddr and notification flags.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00227}00227 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00228}00228 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00229}00229         con = \mbox{\hyperlink{ng__hci__misc_8c_ad17315e3c4e8e2524030e436a48d740b}{ng\_hci\_new\_con}}(unit, \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00230}00230         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00231}00231                 error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00232}00232                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00233}00233         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00234}00234 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00235}00235         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00236}00236 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00237}00237         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00238}00238 \textcolor{comment}{         * Create HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00239}00239 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00240}00240 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00241}00241         MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00242}00242         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00243}00243                 \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00244}00244                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00245}00245                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00246}00246         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00247}00247 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00248}00248         m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(*req);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00249}00249         req = mtod(m, \textcolor{keyword}{struct} acl\_con\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00250}00250         req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00251}00251         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00252}00252         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(\mbox{\hyperlink{ng__hci_8h_aaed6cb3da5f326de065611fe40e75bb7}{NG\_HCI\_OGF\_LINK\_CONTROL}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00253}00253                                         \mbox{\hyperlink{ng__hci_8h_a8011050009b7692bb90b48cadc5f6434}{NG\_HCI\_OCF\_CREATE\_CON}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00254}00254 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00255}00255         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \&req-\/>cp.bdaddr, \textcolor{keyword}{sizeof}(req-\/>cp.bdaddr));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00256}00256 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00257}00257         req-\/>cp.pkt\_type = (\mbox{\hyperlink{ng__hci_8h_a168a1de09e334d846fc5470f31c0ea9e}{NG\_HCI\_PKT\_DM1}}|\mbox{\hyperlink{ng__hci_8h_a2773013c3d87d3b2c869151e67fcc252}{NG\_HCI\_PKT\_DH1}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00258}00258         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[0] \& \mbox{\hyperlink{ng__hci_8h_a577ddabfe683c9eae158f806c45fc101}{NG\_HCI\_LMP\_3SLOT}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00259}00259                 req-\/>cp.pkt\_type |= (\mbox{\hyperlink{ng__hci_8h_a662fd56c3a73920dc916564813ca5c34}{NG\_HCI\_PKT\_DM3}}|\mbox{\hyperlink{ng__hci_8h_adda6f0c6e80a54e6d12c0efb778cb599}{NG\_HCI\_PKT\_DH3}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00260}00260         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[0] \& \mbox{\hyperlink{ng__hci_8h_a1ee774a727859cb8b08e22d729c7b9f1}{NG\_HCI\_LMP\_5SLOT}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00261}00261                 req-\/>cp.pkt\_type |= (\mbox{\hyperlink{ng__hci_8h_ab21cb7872eeb58b5836a7638ab8c2627}{NG\_HCI\_PKT\_DM5}}|\mbox{\hyperlink{ng__hci_8h_af562c865a7f242564b1c9b6fbc6420aa}{NG\_HCI\_PKT\_DH5}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00263}00263         req-\/>cp.pkt\_type \&= unit-\/>\mbox{\hyperlink{structng__hci__unit_a8a02c36db2c0fbe5e6676dce7e50efa4}{packet\_mask}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00264}00264         \textcolor{keywordflow}{if} ((req-\/>cp.pkt\_type \& (\mbox{\hyperlink{ng__hci_8h_a168a1de09e334d846fc5470f31c0ea9e}{NG\_HCI\_PKT\_DM1}}|\mbox{\hyperlink{ng__hci_8h_a2773013c3d87d3b2c869151e67fcc252}{NG\_HCI\_PKT\_DH1}}|}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00265}00265                                  \mbox{\hyperlink{ng__hci_8h_a662fd56c3a73920dc916564813ca5c34}{NG\_HCI\_PKT\_DM3}}|\mbox{\hyperlink{ng__hci_8h_adda6f0c6e80a54e6d12c0efb778cb599}{NG\_HCI\_PKT\_DH3}}|}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00266}00266                                  \mbox{\hyperlink{ng__hci_8h_ab21cb7872eeb58b5836a7638ab8c2627}{NG\_HCI\_PKT\_DM5}}|\mbox{\hyperlink{ng__hci_8h_af562c865a7f242564b1c9b6fbc6420aa}{NG\_HCI\_PKT\_DH5}})) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00267}00267                 req-\/>cp.pkt\_type = (\mbox{\hyperlink{ng__hci_8h_a168a1de09e334d846fc5470f31c0ea9e}{NG\_HCI\_PKT\_DM1}}|\mbox{\hyperlink{ng__hci_8h_a2773013c3d87d3b2c869151e67fcc252}{NG\_HCI\_PKT\_DH1}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00269}00269         req-\/>cp.pkt\_type = htole16(req-\/>cp.pkt\_type);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00271}00271         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[0] \& \mbox{\hyperlink{ng__hci_8h_a61217674f6aa096fc13e2b96d859f953}{NG\_HCI\_LMP\_SWITCH}}) \&\& unit-\/>\mbox{\hyperlink{structng__hci__unit_a0bb7b5bce31956e3061b17420c0a07f5}{role\_switch}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00272}00272                 req-\/>cp.accept\_role\_switch = 1;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00273}00273         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00274}00274                 req-\/>cp.accept\_role\_switch = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00275}00275 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00276}00276         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00277}00277 \textcolor{comment}{         * We may speed up connect by specifying valid parameters. }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00278}00278 \textcolor{comment}{         * So check the neighbor cache.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00279}00279 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00280}00280 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00281}00281         n = \mbox{\hyperlink{ng__hci__misc_8c_afd85df2950d8d6fd0e5237667595c655}{ng\_hci\_get\_neighbor}}(unit, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00282}00282         \textcolor{keywordflow}{if} (n == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00283}00283                 req-\/>cp.page\_scan\_rep\_mode = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00284}00284                 req-\/>cp.page\_scan\_mode = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00285}00285                 req-\/>cp.clock\_offset = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00286}00286         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00287}00287                 req-\/>cp.page\_scan\_rep\_mode = n-\/>\mbox{\hyperlink{structng__hci__neighbor_af6f68090e6a8c7c789a7235b4099c639}{page\_scan\_rep\_mode}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00288}00288                 req-\/>cp.page\_scan\_mode = n-\/>\mbox{\hyperlink{structng__hci__neighbor_af8b3a67a87da9a9f0211a69322a6e811}{page\_scan\_mode}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00289}00289                 req-\/>cp.clock\_offset = htole16(n-\/>\mbox{\hyperlink{structng__hci__neighbor_a5f88df1910f72a24c5279a639ee9f3f2}{clock\_offset}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00290}00290         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00291}00291 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00292}00292         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00293}00293 \textcolor{comment}{         * Adust connection state }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00294}00294 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00296}00296         \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00297}00297                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00298}00298         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00299}00299                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00300}00300 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00301}00301         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} = \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00302}00302         \mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{ng\_hci\_con\_timeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00303}00303 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00304}00304         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00305}00305 \textcolor{comment}{         * Queue and send HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00306}00306 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00307}00307 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00308}00308         \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00309}00309         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00310}00310                 error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00311}00311 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00312}00312         \textcolor{keywordflow}{if} (item != NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00313}00313                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00314}00314 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00315}00315         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00316}00316 \} \textcolor{comment}{/* ng\_hci\_lp\_acl\_con\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00317}00317 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00318}00318 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00319}00319 \textcolor{comment}{ * Request to create new SCO connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00320}00320 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00321}00321 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00322}00322 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00323}\mbox{\hyperlink{ng__hci__ulpi_8c_a201d8affabec185f784c9e4d1383c919}{00323}} \mbox{\hyperlink{ng__hci__ulpi_8c_a201d8affabec185f784c9e4d1383c919}{ng\_hci\_lp\_sco\_con\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00324}00324 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00325}00325         \textcolor{keyword}{struct }sco\_con\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00326}00326                 ng\_hci\_cmd\_pkt\_t         hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00327}00327                 ng\_hci\_add\_sco\_con\_cp    cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00328}00328         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed)) *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00329}00329         \mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}}                *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00330}00330         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}               acl\_con = NULL, sco\_con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00331}00331         \textcolor{keyword}{struct }mbuf                     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00332}00332         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00333}00333 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00334}00334         ep = (\mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00335}00335 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00336}00336         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00337}00337 \textcolor{comment}{         * SCO connection without ACL link}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00338}00338 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00339}00339 \textcolor{comment}{         * If upper layer requests SCO connection and there is no open ACL }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00340}00340 \textcolor{comment}{         * connection to the desired remote unit, we will reject the request.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00341}00341 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00343}00343         LIST\_FOREACH(acl\_con, \&unit-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00344}00344                 \textcolor{keywordflow}{if} (acl\_con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} == \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00345}00345                     acl\_con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} == \mbox{\hyperlink{ng__hci_8h_a03025e63063d215be152dd1f8b86f199}{NG\_HCI\_CON\_OPEN}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00346}00346                     bcmp(\&acl\_con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00347}00347                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00348}00348 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00349}00349         \textcolor{keywordflow}{if} (acl\_con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00350}00350                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00351}00351 \textcolor{stringliteral}{"{}\%s: \%s -\/ No open ACL connection to bdaddr=\%x:\%x:\%x:\%x:\%x:\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00352}00352                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00353}00353                         ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[5], ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[4], ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00354}00354                         ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[2], ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[1], ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}.b[0]);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00355}00355 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00356}00356                 error = ENOENT;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00357}00357                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00358}00358         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00360}00360         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00361}00361 \textcolor{comment}{         * Multiple SCO connections can exist between the same pair of units.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00362}00362 \textcolor{comment}{         * We assume that multiple SCO connections have to be opened one after }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00363}00363 \textcolor{comment}{         * another. }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00364}00364 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00365}00365 \textcolor{comment}{         * Try to find SCO connection descriptor that matches the following:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00366}00366 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00367}00367 \textcolor{comment}{         * 1) sco\_con-\/>link\_type == NG\_HCI\_LINK\_SCO}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00368}00368 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00369}00369 \textcolor{comment}{         * 2) sco\_con-\/>state == NG\_HCI\_CON\_W4\_LP\_CON\_RSP ||}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00370}00370 \textcolor{comment}{         *    sco\_con-\/>state == NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00371}00371 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00372}00372 \textcolor{comment}{         * 3) sco\_con-\/>bdaddr == ep-\/>bdaddr}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00373}00373 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00374}00374 \textcolor{comment}{         * Two cases:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00375}00375 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00376}00376 \textcolor{comment}{         * 1) We do not have connection descriptor. This is simple. Just }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00377}00377 \textcolor{comment}{         *    create new connection and submit Add\_SCO\_Connection command.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00378}00378 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00379}00379 \textcolor{comment}{         * 2) We do have connection descriptor. We need to check the state.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00380}00380 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00381}00381 \textcolor{comment}{         * 2.1) NG\_HCI\_CON\_W4\_LP\_CON\_RSP means we in the middle of accepting}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00382}00382 \textcolor{comment}{         *      connection from the remote unit. This is a race condition and}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00383}00383 \textcolor{comment}{         *      we will ignore the request.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00384}00384 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00385}00385 \textcolor{comment}{         * 2.2) NG\_HCI\_CON\_W4\_CONN\_COMPLETE means upper layer already requested}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00386}00386 \textcolor{comment}{         *      connection or we just accepted it.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00387}00387 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00388}00388 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00389}00389         LIST\_FOREACH(sco\_con, \&unit-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00390}00390                 \textcolor{keywordflow}{if} (sco\_con-\/>link\_type == \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00391}00391                     (sco\_con-\/>state == \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}} ||}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00392}00392                      sco\_con-\/>state == \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00393}00393                     bcmp(\&sco\_con-\/>bdaddr, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00394}00394                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00395}00395 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00396}00396         \textcolor{keywordflow}{if} (sco\_con != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00397}00397                 \textcolor{keywordflow}{switch} (sco\_con-\/>state) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00398}00398                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}}: \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00399}00399                         error = EALREADY;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00400}00400                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00401}00401 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00402}00402                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00403}00403                         sco\_con-\/>flags |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00404}00404                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00405}00405 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00406}00406                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00407}00407                         panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00408}00408 \textcolor{stringliteral}{"{}\%s: \%s -\/ Invalid connection state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00409}00409                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00410}00410                                 sco\_con-\/>state);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00411}00411                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00412}00412                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00413}00413 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00414}00414                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00415}00415         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00416}00416 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00417}00417         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00418}00418 \textcolor{comment}{         * If we got here then we need to create new SCO connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00419}00419 \textcolor{comment}{         * and submit HCI command.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00420}00420 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00422}00422         sco\_con = \mbox{\hyperlink{ng__hci__misc_8c_ad17315e3c4e8e2524030e436a48d740b}{ng\_hci\_new\_con}}(unit, \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00423}00423         \textcolor{keywordflow}{if} (sco\_con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00424}00424                 error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00425}00425                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00426}00426         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00427}00427 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00428}00428         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \&sco\_con-\/>bdaddr, \textcolor{keyword}{sizeof}(sco\_con-\/>bdaddr));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00430}00430         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00431}00431 \textcolor{comment}{         * Create HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00432}00432 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00433}00433 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00434}00434         MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00435}00435         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00436}00436                 \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(sco\_con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00437}00437                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00438}00438                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00439}00439         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00441}00441         m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(*req);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00442}00442         req = mtod(m, \textcolor{keyword}{struct} sco\_con\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00443}00443         req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00444}00444         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00445}00445         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(\mbox{\hyperlink{ng__hci_8h_aaed6cb3da5f326de065611fe40e75bb7}{NG\_HCI\_OGF\_LINK\_CONTROL}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00446}00446                                         \mbox{\hyperlink{ng__hci_8h_a74addd0ec8f0047976cfe058aab105b7}{NG\_HCI\_OCF\_ADD\_SCO\_CON}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00448}00448         req-\/>cp.con\_handle = htole16(acl\_con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00449}00449 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00450}00450         req-\/>cp.pkt\_type = \mbox{\hyperlink{ng__hci_8h_a209411a2aa88f428efce1bbb4c2e623f}{NG\_HCI\_PKT\_HV1}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00451}00451         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[1] \& \mbox{\hyperlink{ng__hci_8h_ad75024c76777d79e8f7e49b8314194e5}{NG\_HCI\_LMP\_HV2\_PKT}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00452}00452                 req-\/>cp.pkt\_type |= \mbox{\hyperlink{ng__hci_8h_ac17d15d3876214dacdb29f1c16983a8b}{NG\_HCI\_PKT\_HV2}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00453}00453         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[1] \& \mbox{\hyperlink{ng__hci_8h_ab1436fb687026c5560bd6c01f0108b24}{NG\_HCI\_LMP\_HV3\_PKT}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00454}00454                 req-\/>cp.pkt\_type |= \mbox{\hyperlink{ng__hci_8h_a209e7015e3a06cb1187500286b6eafe6}{NG\_HCI\_PKT\_HV3}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00455}00455 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00456}00456         req-\/>cp.pkt\_type \&= unit-\/>\mbox{\hyperlink{structng__hci__unit_a8a02c36db2c0fbe5e6676dce7e50efa4}{packet\_mask}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00457}00457         \textcolor{keywordflow}{if} ((req-\/>cp.pkt\_type \& (\mbox{\hyperlink{ng__hci_8h_a209411a2aa88f428efce1bbb4c2e623f}{NG\_HCI\_PKT\_HV1}}|}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00458}00458                                  \mbox{\hyperlink{ng__hci_8h_ac17d15d3876214dacdb29f1c16983a8b}{NG\_HCI\_PKT\_HV2}}|}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00459}00459                                  \mbox{\hyperlink{ng__hci_8h_a209e7015e3a06cb1187500286b6eafe6}{NG\_HCI\_PKT\_HV3}})) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00460}00460                 req-\/>cp.pkt\_type = \mbox{\hyperlink{ng__hci_8h_a209411a2aa88f428efce1bbb4c2e623f}{NG\_HCI\_PKT\_HV1}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00462}00462         req-\/>cp.pkt\_type = htole16(req-\/>cp.pkt\_type);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00464}00464         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00465}00465 \textcolor{comment}{         * Adust connection state}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00466}00466 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00467}00467 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00468}00468         sco\_con-\/>flags |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00469}00469 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00470}00470         sco\_con-\/>state = \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00471}00471         \mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{ng\_hci\_con\_timeout}}(sco\_con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00472}00472 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00473}00473         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00474}00474 \textcolor{comment}{         * Queue and send HCI command}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00475}00475 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00476}00476 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00477}00477         \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00478}00478         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00479}00479                 error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00480}00480 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00481}00481         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00482}00482 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00483}00483         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00484}00484 \} \textcolor{comment}{/* ng\_hci\_lp\_sco\_con\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00486}00486 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00487}\mbox{\hyperlink{ng__hci__ulpi_8c_acec66d0b12281a322a618b550af8032c}{00487}} \mbox{\hyperlink{ng__hci__ulpi_8c_acec66d0b12281a322a618b550af8032c}{ng\_hci\_lp\_le\_con\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{int} link\_type)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00488}00488 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00489}00489         \textcolor{keyword}{struct }acl\_con\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00490}00490                 ng\_hci\_cmd\_pkt\_t         hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00491}00491                 ng\_hci\_le\_create\_connection\_cp   cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00492}00492         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed)) *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00493}00493         \mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}}                *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00494}00494         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}               con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00495}00495         \textcolor{keyword}{struct }mbuf                     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00496}00496         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00497}00497 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00498}00498         ep = (\mbox{\hyperlink{structng__hci__lp__con__req__ep}{ng\_hci\_lp\_con\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00499}00499         \textcolor{keywordflow}{if}((link\_type != \mbox{\hyperlink{ng__hci_8h_afecc38805812b20f02942504b17892f4}{NG\_HCI\_LINK\_LE\_PUBLIC}})\&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00500}00500            (link\_type != \mbox{\hyperlink{ng__hci_8h_a557665f3f28bb33759ed8ec4eb28d385}{NG\_HCI\_LINK\_LE\_RANDOM}}))\{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00501}00501                 printf(\textcolor{stringliteral}{"{}\%s: Link type \%d Cannot be here \(\backslash\)n"{}}, \_\_func\_\_, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00502}00502                        link\_type);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00503}00503         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00504}00504         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00505}00505 \textcolor{comment}{         * Only one ACL connection can exist between each pair of units.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00506}00506 \textcolor{comment}{         * So try to find ACL connection descriptor (in any state) that}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00507}00507 \textcolor{comment}{         * has requested remote BD\_ADDR.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00508}00508 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00509}00509 \textcolor{comment}{         * Two cases:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00510}00510 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00511}00511 \textcolor{comment}{         * 1) We do not have connection to the remote unit. This is simple.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00512}00512 \textcolor{comment}{         *    Just create new connection descriptor and send HCI command to}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00513}00513 \textcolor{comment}{         *    create new connection.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00514}00514 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00515}00515 \textcolor{comment}{         * 2) We do have connection descriptor. We need to check connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00516}00516 \textcolor{comment}{         *    state:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00517}00517 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00518}00518 \textcolor{comment}{         * 2.1) NG\_HCI\_CON\_W4\_LP\_CON\_RSP means that we are in the middle of}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00519}00519 \textcolor{comment}{         *      accepting connection from the remote unit. This is a race}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00520}00520 \textcolor{comment}{         *      condition. We will ignore this message.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00521}00521 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00522}00522 \textcolor{comment}{         * 2.2) NG\_HCI\_CON\_W4\_CONN\_COMPLETE means that upper layer already}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00523}00523 \textcolor{comment}{         *      requested connection or we just accepted it. In any case}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00524}00524 \textcolor{comment}{         *      all we need to do here is set appropriate notification bit}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00525}00525 \textcolor{comment}{         *      and wait.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00526}00526 \textcolor{comment}{         *      }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00527}00527 \textcolor{comment}{         * 2.3) NG\_HCI\_CON\_OPEN means connection is open. Just reply back}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00528}00528 \textcolor{comment}{         *      and let upper layer know that we have connection already.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00529}00529 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00530}00530 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00531}00531         con = \mbox{\hyperlink{ng__hci__misc_8c_ad9bc4055b9ba79cb181bd3b6ddf1e500}{ng\_hci\_con\_by\_bdaddr}}(unit, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, link\_type);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00532}00532         \textcolor{keywordflow}{if} (con != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00533}00533                 \textcolor{keywordflow}{switch} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00534}00534                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}}: \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00535}00535                         error = EALREADY;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00536}00536                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00538}00538                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00539}00539                         \textcolor{keywordflow}{if} (hook != unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00540}00540                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00541}00541                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00542}00542                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00543}00543                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00544}00544 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00545}00545                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a03025e63063d215be152dd1f8b86f199}{NG\_HCI\_CON\_OPEN}}: \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00546}00546                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00547}00547                         \mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}}        *cfm = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00548}00548 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00549}00549                         \textcolor{keywordflow}{if} (hook != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(hook)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00550}00550                                 \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00551}00551                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00552}00552 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00553}00553                                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00554}00554                                         \mbox{\hyperlink{ng__hci_8h_a9aef59b1ef1df1d8613c3aea5fe9f6f1}{NGM\_HCI\_LP\_CON\_CFM}}, \textcolor{keyword}{sizeof}(*cfm), }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00555}00555                                         M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00556}00556                                 \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00557}00557                                         cfm = (\mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00558}00558                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_af1a6707b98c4fbf873960d6fa082896e}{status}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00559}00559                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_a73392be13c53de03cb2c11e311d3957e}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00560}00560                                         cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aaf2a9d9cffcbf4b8ec30a3cbfb77cfec}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00561}00561                                         bcopy(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00562}00562                                                 \textcolor{keyword}{sizeof}(cfm-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00563}00563 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00564}00564                                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00565}00565 \textcolor{comment}{                                         * This will forward item back to}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00566}00566 \textcolor{comment}{                                         * sender and set item to NULL}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00567}00567 \textcolor{comment}{                                         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00568}00568 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00569}00569                                         \mbox{\hyperlink{netgraph_8h_a2e08902bb82fa382275ab4aef2cda802}{\_NGI\_MSG}}(item) = msg;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00570}00570                                         \mbox{\hyperlink{netgraph_8h_a52b448e5f7440d396bb16d481af55b64}{NG\_FWD\_ITEM\_HOOK}}(error, item, hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00571}00571                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00572}00572                                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00573}00573                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00574}00574                                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00575}00575 \textcolor{stringliteral}{"{}\%s: \%s -\/ Source hook is not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00576}00576                                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00577}00577                                         hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00578}00578                         \} \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00579}00579 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00580}00580                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00581}00581                         panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00582}00582 \textcolor{stringliteral}{"{}\%s: \%s -\/ Invalid connection state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00583}00583                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00584}00584                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00585}00585                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00586}00586 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00587}00587                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00588}00588         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00589}00589 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00590}00590         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00591}00591 \textcolor{comment}{         * If we got here then we need to create new ACL connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00592}00592 \textcolor{comment}{         * and submit HCI command. First create new connection desriptor, set}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00593}00593 \textcolor{comment}{         * bdaddr and notification flags.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00594}00594 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00595}00595 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00596}00596         con = \mbox{\hyperlink{ng__hci__misc_8c_ad17315e3c4e8e2524030e436a48d740b}{ng\_hci\_new\_con}}(unit, link\_type);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00597}00597         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00598}00598                 error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00599}00599                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00600}00600         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00601}00601 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00602}00602         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00603}00603 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00604}00604         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00605}00605 \textcolor{comment}{         * Create HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00606}00606 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00607}00607 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00608}00608         MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00609}00609         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00610}00610                 \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00611}00611                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00612}00612                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00613}00613         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00614}00614 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00615}00615         m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(*req);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00616}00616         req = mtod(m, \textcolor{keyword}{struct} acl\_con\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00617}00617         req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00618}00618         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00619}00619         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(\mbox{\hyperlink{ng__hci_8h_a1abd8fba8b6e81acc5c684376c262d91}{NG\_HCI\_OGF\_LE}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00620}00620                                         \mbox{\hyperlink{ng__hci_8h_a82482285e0d03a0f54fb74c602e03e45}{NG\_HCI\_OCF\_LE\_CREATE\_CONNECTION}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00621}00621 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00622}00622         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__req__ep_a06fa02077968ff2378a8b75513f86697}{bdaddr}}, \&req-\/>cp.peer\_addr, \textcolor{keyword}{sizeof}(req-\/>cp.peer\_addr));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00623}00623         req-\/>cp.own\_address\_type = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00624}00624         req-\/>cp.peer\_addr\_type = (link\_type == \mbox{\hyperlink{ng__hci_8h_a557665f3f28bb33759ed8ec4eb28d385}{NG\_HCI\_LINK\_LE\_RANDOM}})? 1:0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00625}00625         req-\/>cp.scan\_interval = htole16(4);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00626}00626         req-\/>cp.scan\_window = htole16(4);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00627}00627         req-\/>cp.filter\_policy = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00628}00628         req-\/>cp.conn\_interval\_min = htole16(0xf);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00629}00629         req-\/>cp.conn\_interval\_max = htole16(0xf);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00630}00630         req-\/>cp.conn\_latency = htole16(0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00631}00631         req-\/>cp.supervision\_timeout = htole16(0xc80);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00632}00632         req-\/>cp.min\_ce\_length = htole16(1);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00633}00633         req-\/>cp.max\_ce\_length = htole16(1);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00634}00634         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00635}00635 \textcolor{comment}{         * Adust connection state }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00636}00636 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00637}00637 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00638}00638         \textcolor{keywordflow}{if} (hook != unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00639}00639                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00640}00640         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00641}00641                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00642}00642 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00643}00643         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} = \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00644}00644         \mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{ng\_hci\_con\_timeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00645}00645 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00646}00646         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00647}00647 \textcolor{comment}{         * Queue and send HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00648}00648 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00649}00649 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00650}00650         \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00651}00651         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00652}00652                 error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00653}00653 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00654}00654         \textcolor{keywordflow}{if} (item != NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00655}00655                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00656}00656 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00657}00657         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00658}00658 \} \textcolor{comment}{/* ng\_hci\_lp\_acl\_con\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00659}00659 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00660}00660 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00661}00661 \textcolor{comment}{ * Process LP\_DisconnectReq event from the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00662}00662 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00663}00663 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00664}00664 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00665}\mbox{\hyperlink{ng__hci__ulpi_8c_ac8f40b4237004bfeadec67a4703912a6}{00665}} \mbox{\hyperlink{ng__hci__ulpi_8c_ac8f40b4237004bfeadec67a4703912a6}{ng\_hci\_lp\_discon\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00666}00666 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00667}00667         \textcolor{keyword}{struct }discon\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00668}00668                 ng\_hci\_cmd\_pkt\_t         hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00669}00669                 ng\_hci\_discon\_cp         cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00670}00670         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed)) *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00671}00671         \mbox{\hyperlink{structng__hci__lp__discon__req__ep}{ng\_hci\_lp\_discon\_req\_ep}}          *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00672}00672         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}               con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00673}00673         \textcolor{keyword}{struct }mbuf                     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00674}00674         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00675}00675 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00676}00676         \textcolor{comment}{/* Check if unit is ready */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00677}00677         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) != \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00678}00678                 \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00679}00679 \textcolor{stringliteral}{"{}\%s: \%s -\/ unit is not ready, state=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00680}00680                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00681}00681 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00682}00682                 error = ENXIO;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00683}00683                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00684}00684         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00685}00685 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00686}00686         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen != \textcolor{keyword}{sizeof}(*ep)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00687}00687                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00688}00688 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid LP\_DisconnectReq message size=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00689}00689                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00690}00690                         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00691}00691 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00692}00692                 error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00693}00693                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00694}00694         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00695}00695 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00696}00696         ep = (\mbox{\hyperlink{structng__hci__lp__discon__req__ep}{ng\_hci\_lp\_discon\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00697}00697 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00698}00698         con = \mbox{\hyperlink{ng__hci__misc_8c_a3b509cac93de160d32cdfb5a59ccff54}{ng\_hci\_con\_by\_handle}}(unit, ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__req__ep_a370981d30c1251b0bda0b96421409935}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00699}00699         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00700}00700                 \mbox{\hyperlink{ng__hci__var_8h_a347403c3d9eebde8aa890c65b4ab5874}{NG\_HCI\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00701}00701 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid connection handle=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00702}00702                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__req__ep_a370981d30c1251b0bda0b96421409935}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00703}00703 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00704}00704                 error = ENOENT;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00705}00705                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00706}00706         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00707}00707 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00708}00708         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} != \mbox{\hyperlink{ng__hci_8h_a03025e63063d215be152dd1f8b86f199}{NG\_HCI\_CON\_OPEN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00709}00709                 \mbox{\hyperlink{ng__hci__var_8h_a347403c3d9eebde8aa890c65b4ab5874}{NG\_HCI\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00710}00710 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid connection state=\%d, handle=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00711}00711                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00712}00712                         ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__req__ep_a370981d30c1251b0bda0b96421409935}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00713}00713 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00714}00714                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00715}00715                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00716}00716         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00717}00717 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00718}00718         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00719}00719 \textcolor{comment}{         * Create HCI command}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00720}00720 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00721}00721 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00722}00722         MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00723}00723         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00724}00724                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00725}00725                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00726}00726         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00727}00727 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00728}00728         m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(*req);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00729}00729         req = mtod(m, \textcolor{keyword}{struct} discon\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00730}00730         req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00731}00731         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00732}00732         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(\mbox{\hyperlink{ng__hci_8h_aaed6cb3da5f326de065611fe40e75bb7}{NG\_HCI\_OGF\_LINK\_CONTROL}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00733}00733                                                         \mbox{\hyperlink{ng__hci_8h_a06ef3e698e8825d989bf126bd372b691}{NG\_HCI\_OCF\_DISCON}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00734}00734 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00735}00735         req-\/>cp.con\_handle = htole16(ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__req__ep_a370981d30c1251b0bda0b96421409935}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00736}00736         req-\/>cp.reason = ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__req__ep_af666ee62dd762fe879091dcf05d7f7da}{reason}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00737}00737 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00738}00738         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00739}00739 \textcolor{comment}{         * Queue and send HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00740}00740 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00741}00741 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00742}00742         \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00743}00743         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00744}00744                 error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00745}00745 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00746}00746         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00747}00747 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00748}00748         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00749}00749 \} \textcolor{comment}{/* ng\_hci\_lp\_discon\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00750}00750 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00751}00751 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00752}00752 \textcolor{comment}{ * Send LP\_ConnectCfm event to the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00753}00753 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00754}00754 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00755}00755 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00756}\mbox{\hyperlink{ng__hci__ulpi_8c_a771e897a940d04cdff7f91354b165f39}{00756}} \mbox{\hyperlink{ng__hci__ulpi_8c_a771e897a940d04cdff7f91354b165f39}{ng\_hci\_lp\_con\_cfm}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00757}00757 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00758}00758         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00759}00759         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00760}00760         \mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}}        *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00761}00761         \textcolor{keywordtype}{int}                      error;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00762}00762 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00763}00763         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00764}00764 \textcolor{comment}{         * Check who wants to be notified. For ACL links both ACL and SCO}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00765}00765 \textcolor{comment}{         * upstream hooks will be notified (if required). For SCO links}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00766}00766 \textcolor{comment}{         * only SCO upstream hook will receive notification}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00767}00767 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00768}00768 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00769}00769         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}} \&\& }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00770}00770             con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00771}00771                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00772}00772                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_a9aef59b1ef1df1d8613c3aea5fe9f6f1}{NGM\_HCI\_LP\_CON\_CFM}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00773}00773                                 \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00774}00774                         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00775}00775                                 ep = (\mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00776}00776                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_af1a6707b98c4fbf873960d6fa082896e}{status}} = \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00777}00777                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_a73392be13c53de03cb2c11e311d3957e}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00778}00778                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aaf2a9d9cffcbf4b8ec30a3cbfb77cfec}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00779}00779                                 bcopy(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00780}00780                                         \textcolor{keyword}{sizeof}(ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00781}00781 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00782}00782                                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00783}00783                                         unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00784}00784                         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00785}00785                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00786}00786                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00787}00787 \textcolor{stringliteral}{"{}\%s: \%s -\/ ACL hook not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00788}00788                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00789}00789 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00790}00790                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_NOTIFY\_ACL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00791}00791         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00792}00792 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00793}00793         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00794}00794                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00795}00795                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_a9aef59b1ef1df1d8613c3aea5fe9f6f1}{NGM\_HCI\_LP\_CON\_CFM}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00796}00796                                 \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00797}00797                         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00798}00798                                 ep = (\mbox{\hyperlink{structng__hci__lp__con__cfm__ep}{ng\_hci\_lp\_con\_cfm\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00799}00799                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_af1a6707b98c4fbf873960d6fa082896e}{status}} = \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00800}00800                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_a73392be13c53de03cb2c11e311d3957e}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00801}00801                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aaf2a9d9cffcbf4b8ec30a3cbfb77cfec}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00802}00802                                 bcopy(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00803}00803                                         \textcolor{keyword}{sizeof}(ep-\/>\mbox{\hyperlink{structng__hci__lp__con__cfm__ep_aa056a5791b6649a1a84ded0b21862e49}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00804}00804 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00805}00805                                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00806}00806                                         unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00807}00807                         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00808}00808                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00809}00809                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00810}00810 \textcolor{stringliteral}{"{}\%s: \%s -\/ SCO hook not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00811}00811                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00812}00812 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00813}00813                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_NOTIFY\_SCO;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00814}00814         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00815}00815 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00816}00816         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00817}00817 \} \textcolor{comment}{/* ng\_hci\_lp\_con\_cfm */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00818}00818 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00819}00819 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00820}\mbox{\hyperlink{ng__hci__ulpi_8c_ac18669e3331a9eb15072ba45b0e926ae}{00820}} \mbox{\hyperlink{ng__hci__ulpi_8c_ac18669e3331a9eb15072ba45b0e926ae}{ng\_hci\_lp\_enc\_change}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00821}00821 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00822}00822         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00823}00823         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00824}00824         \mbox{\hyperlink{structng__hci__lp__enc__change__ep}{ng\_hci\_lp\_enc\_change\_ep}}  *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00825}00825         \textcolor{keywordtype}{int}                      error;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00826}00826 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00827}00827         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00828}00828                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00829}00829                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_aa41e23e89a47c49cc05161142c3848f1}{NGM\_HCI\_LP\_ENC\_CHG}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00830}00830                                 \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00831}00831                         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00832}00832                                 ep = (\mbox{\hyperlink{structng__hci__lp__enc__change__ep}{ng\_hci\_lp\_enc\_change\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00833}00833                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__enc__change__ep_a0cc21e364d2f6e0f0fbd030e11bb9a15}{status}} = \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00834}00834                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__enc__change__ep_a620fc55f975d87ceca216e010dad9595}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00835}00835                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__enc__change__ep_a3d6ec0062166373030f9da4f313a65e1}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00836}00836 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00837}00837                                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00838}00838                                         unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00839}00839                         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00840}00840                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00841}00841                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00842}00842 \textcolor{stringliteral}{"{}\%s: \%s -\/ ACL hook not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00843}00843                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00844}00844         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00845}00845         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00846}00846 \} \textcolor{comment}{/* ng\_hci\_lp\_con\_cfm */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00847}00847 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00848}00848 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00849}00849 \textcolor{comment}{ * Send LP\_ConnectInd event to the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00850}00850 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00851}00851 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00852}00852 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00853}\mbox{\hyperlink{ng__hci__ulpi_8c_a38410249a3349ce11a02fe83d8700fd9}{00853}} \mbox{\hyperlink{ng__hci__ulpi_8c_a38410249a3349ce11a02fe83d8700fd9}{ng\_hci\_lp\_con\_ind}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con, u\_int8\_t *uclass)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00854}00854 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00855}00855         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00856}00856         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00857}00857         \mbox{\hyperlink{structng__hci__lp__con__ind__ep}{ng\_hci\_lp\_con\_ind\_ep}}        *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00858}00858         \mbox{\hyperlink{structng__hook}{hook\_p}}                     hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00859}00859         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00860}00860 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00861}00861         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00862}00862 \textcolor{comment}{         * Connection\_Request event is generated for specific link type.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00863}00863 \textcolor{comment}{         * Use link\_type to select upstream hook.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00864}00864 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00865}00865 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00866}00866         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00867}00867                 hook = unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00868}00868         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00869}00869                 hook = unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00870}00870 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00871}00871         \textcolor{keywordflow}{if} (hook != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(hook)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00872}00872                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_a41ef3f08abb47fd43e392df8e813e20c}{NGM\_HCI\_LP\_CON\_IND}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00873}00873                         \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00874}00874                 \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00875}00875                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00876}00876 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00877}00877                 ep = (\mbox{\hyperlink{structng__hci__lp__con__ind__ep}{ng\_hci\_lp\_con\_ind\_ep}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00878}00878                 ep-\/>\mbox{\hyperlink{structng__hci__lp__con__ind__ep_a9d30847f69e15eae1d5bbf3391f2e10a}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00879}00879                 bcopy(uclass, ep-\/>\mbox{\hyperlink{structng__hci__lp__con__ind__ep_a66f8c53eb3f6af2874b4a482ddfab5dd}{uclass}}, \textcolor{keyword}{sizeof}(ep-\/>\mbox{\hyperlink{structng__hci__lp__con__ind__ep_a66f8c53eb3f6af2874b4a482ddfab5dd}{uclass}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00880}00880                 bcopy(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__ind__ep_a65a92edcfd9f95da49b8bf7378e75fad}{bdaddr}}, \textcolor{keyword}{sizeof}(ep-\/>\mbox{\hyperlink{structng__hci__lp__con__ind__ep_a65a92edcfd9f95da49b8bf7378e75fad}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00881}00881 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00882}00882                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg, hook, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00883}00883         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00884}00884                 \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00885}00885 \textcolor{stringliteral}{"{}\%s: \%s -\/ Upstream hook is not connected or not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00886}00886                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), hook);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00887}00887 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00888}00888                 error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00889}00889         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00890}00890 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00891}00891         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00892}00892 \} \textcolor{comment}{/* ng\_hci\_lp\_con\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00893}00893 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00894}00894 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00895}00895 \textcolor{comment}{ * Process LP\_ConnectRsp event from the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00896}00896 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00897}00897 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00898}00898 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00899}\mbox{\hyperlink{ng__hci__ulpi_8c_a9d31a24d5ac0f002ac89e3934aa5fe4c}{00899}} \mbox{\hyperlink{ng__hci__ulpi_8c_a9d31a24d5ac0f002ac89e3934aa5fe4c}{ng\_hci\_lp\_con\_rsp}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00900}00900 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00901}00901         \textcolor{keyword}{struct }con\_rsp\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00902}00902                 ng\_hci\_cmd\_pkt\_t                 hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00903}00903                 \textcolor{keyword}{union }\{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00904}00904                         ng\_hci\_accept\_con\_cp     acc;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00905}00905                         ng\_hci\_reject\_con\_cp     rej;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00906}00906                 \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed))  cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00907}00907         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed))         *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00908}00908         \mbox{\hyperlink{structng__hci__lp__con__rsp__ep}{ng\_hci\_lp\_con\_rsp\_ep}}                        *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00909}00909         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}                       con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00910}00910         \textcolor{keyword}{struct }mbuf                             *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00911}00911         \textcolor{keywordtype}{int}                                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00912}00912 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00913}00913         \textcolor{comment}{/* Check if unit is ready */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00914}00914         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) != \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00915}00915                 \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00916}00916 \textcolor{stringliteral}{"{}\%s: \%s -\/ unit is not ready, state=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00917}00917                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00918}00918 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00919}00919                 error = ENXIO;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00920}00920                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00921}00921         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00922}00922 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00923}00923         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen != \textcolor{keyword}{sizeof}(*ep)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00924}00924                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00925}00925 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid LP\_ConnectRsp message size=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00926}00926                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00927}00927                         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00928}00928 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00929}00929                 error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00930}00930                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00931}00931         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00932}00932 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00933}00933         ep = (\mbox{\hyperlink{structng__hci__lp__con__rsp__ep}{ng\_hci\_lp\_con\_rsp\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00934}00934 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00935}00935         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00936}00936 \textcolor{comment}{         * Here we have to deal with race. Upper layers might send conflicting}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00937}00937 \textcolor{comment}{         * requests. One might send Accept and other Reject. We will not try}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00938}00938 \textcolor{comment}{         * to solve all the problems, so first request will always win.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00939}00939 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00940}00940 \textcolor{comment}{         * Try to find connection that matches the following:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00941}00941 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00942}00942 \textcolor{comment}{         * 1) con-\/>link\_type == ep-\/>link\_type}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00943}00943 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00944}00944 \textcolor{comment}{         * 2) con-\/>state == NG\_HCI\_CON\_W4\_LP\_CON\_RSP ||}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00945}00945 \textcolor{comment}{         *    con-\/>state == NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00946}00946 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00947}00947 \textcolor{comment}{         * 3) con-\/>bdaddr == ep-\/>bdaddr}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00948}00948 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00949}00949 \textcolor{comment}{         * Two cases:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00950}00950 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00951}00951 \textcolor{comment}{         * 1) We do not have connection descriptor. Could be bogus request or}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00952}00952 \textcolor{comment}{         *    we have rejected connection already.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00953}00953 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00954}00954 \textcolor{comment}{         * 2) We do have connection descriptor. Then we need to check state:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00955}00955 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00956}00956 \textcolor{comment}{         * 2.1) NG\_HCI\_CON\_W4\_LP\_CON\_RSP means upper layer has requested }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00957}00957 \textcolor{comment}{         *      connection and it is a first response from the upper layer.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00958}00958 \textcolor{comment}{         *      if "{}status == 0"{} (Accept) then we will send Accept\_Connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00959}00959 \textcolor{comment}{         *      command and change connection state to W4\_CONN\_COMPLETE, else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00960}00960 \textcolor{comment}{         *      send reject and delete connection.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00961}00961 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00962}00962 \textcolor{comment}{         * 2.2) NG\_HCI\_CON\_W4\_CONN\_COMPLETE means that we already accepted }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00963}00963 \textcolor{comment}{         *      connection. If "{}status == 0"{} we just need to link request}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00964}00964 \textcolor{comment}{         *      and wait, else ignore Reject request.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00965}00965 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00966}00966 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00967}00967         LIST\_FOREACH(con, \&unit-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00968}00968                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} == ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_a394a0015c281c4c4a556ed679d213c3a}{link\_type}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00969}00969                     (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} == \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}} ||}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00970}00970                      con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} == \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00971}00971                     bcmp(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_afe493857868a77fd9b9e5c9aaa2d4b2b}{bdaddr}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00972}00972                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00973}00973 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00974}00974         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00975}00975                 \textcolor{comment}{/* Reject for non-\/existing connection is fine */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00976}00976                 error = (ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_a591d3f0a4461ba09c5ddb467d4eb8226}{status}} == 0)? ENOENT : 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00977}00977                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00978}00978         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00979}00979 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00980}00980         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00981}00981 \textcolor{comment}{         * Remove connection timeout and check connection state.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00982}00982 \textcolor{comment}{         * Note: if ng\_hci\_con\_untimeout() fails (returns non-\/zero value) then}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00983}00983 \textcolor{comment}{         * timeout already happened and event went into node's queue.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00984}00984 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00985}00985 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00986}00986         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__hci__misc_8c_aec1ab0e4733596907113e77d1313c9a7}{ng\_hci\_con\_untimeout}}(con)) != 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00987}00987                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00988}00988 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00989}00989         \textcolor{keywordflow}{switch} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00990}00990         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00991}00991 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00992}00992                 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00993}00993 \textcolor{comment}{                 * Create HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00994}00994 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00995}00995 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00996}00996                 MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00997}00997                 \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00998}00998                         error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l00999}00999                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01000}01000                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01001}01001                 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01002}01002                 req = mtod(m, \textcolor{keyword}{struct} con\_rsp\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01003}01003                 req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01004}01004 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01005}01005                 \textcolor{keywordflow}{if} (ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_a591d3f0a4461ba09c5ddb467d4eb8226}{status}} == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01006}01006                         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp.acc);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01007}01007                         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01008}01008                                                         \mbox{\hyperlink{ng__hci_8h_aaed6cb3da5f326de065611fe40e75bb7}{NG\_HCI\_OGF\_LINK\_CONTROL}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01009}01009                                                         \mbox{\hyperlink{ng__hci_8h_a1dcb28e9da13c3007b7861c625dd2a7a}{NG\_HCI\_OCF\_ACCEPT\_CON}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01010}01010 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01011}01011                         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_afe493857868a77fd9b9e5c9aaa2d4b2b}{bdaddr}}, \&req-\/>cp.acc.bdaddr,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01012}01012                                 \textcolor{keyword}{sizeof}(req-\/>cp.acc.bdaddr));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01013}01013 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01014}01014                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01015}01015 \textcolor{comment}{                         * We are accepting connection, so if we support role }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01016}01016 \textcolor{comment}{                         * switch and role switch was enabled then set role to }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01017}01017 \textcolor{comment}{                         * NG\_HCI\_ROLE\_MASTER and let LM peform role switch.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01018}01018 \textcolor{comment}{                         * Otherwise we remain slave. In this case LM WILL NOT}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01019}01019 \textcolor{comment}{                         * perform role switch.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01020}01020 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01021}01021 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01022}01022                         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_aa996a4dc37a1ae6baefc2f7b31a819b7}{features}}[0] \& \mbox{\hyperlink{ng__hci_8h_a61217674f6aa096fc13e2b96d859f953}{NG\_HCI\_LMP\_SWITCH}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01023}01023                             unit-\/>\mbox{\hyperlink{structng__hci__unit_a0bb7b5bce31956e3061b17420c0a07f5}{role\_switch}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01024}01024                                 req-\/>cp.acc.role = \mbox{\hyperlink{ng__hci_8h_ad7068a81d4ff7a79ee2cf2c8a999fedf}{NG\_HCI\_ROLE\_MASTER}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01025}01025                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01026}01026                                 req-\/>cp.acc.role = \mbox{\hyperlink{ng__hci_8h_ae0243a8f3ed2a8357d0b92fc5fab998c}{NG\_HCI\_ROLE\_SLAVE}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01027}01027 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01028}01028                         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01029}01029 \textcolor{comment}{                         * Adjust connection state }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01030}01030 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01031}01031 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01032}01032                         \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01033}01033                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01034}01034                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01035}01035                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01036}01036 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01037}01037                         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} = \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01038}01038                         \mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{ng\_hci\_con\_timeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01039}01039                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01040}01040                         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp.rej);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01041}01041                         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01042}01042                                                         \mbox{\hyperlink{ng__hci_8h_aaed6cb3da5f326de065611fe40e75bb7}{NG\_HCI\_OGF\_LINK\_CONTROL}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01043}01043                                                         \mbox{\hyperlink{ng__hci_8h_a4d3676dfee4277b30fdd4bea4638ce20}{NG\_HCI\_OCF\_REJECT\_CON}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01044}01044 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01045}01045                         bcopy(\&ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_afe493857868a77fd9b9e5c9aaa2d4b2b}{bdaddr}}, \&req-\/>cp.rej.bdaddr,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01046}01046                                 \textcolor{keyword}{sizeof}(req-\/>cp.rej.bdaddr));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01047}01047 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01048}01048                         req-\/>cp.rej.reason = ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_a591d3f0a4461ba09c5ddb467d4eb8226}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01049}01049 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01050}01050                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01051}01051 \textcolor{comment}{                         * Free connection descritor}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01052}01052 \textcolor{comment}{                         * Item will be deleted just before return.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01053}01053 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01054}01054                         }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01055}01055                         \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01056}01056                 \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01057}01057 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01058}01058                 m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(req-\/>hdr) + req-\/>hdr.length;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01059}01059 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01060}01060                 \textcolor{comment}{/* Queue and send HCI command */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01061}01061                 \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01062}01062                 \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01063}01063                         error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01064}01064                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01065}01065 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01066}01066         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01067}01067                 \textcolor{keywordflow}{if} (ep-\/>\mbox{\hyperlink{structng__hci__lp__con__rsp__ep_a591d3f0a4461ba09c5ddb467d4eb8226}{status}} == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01068}01068                         \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01069}01069                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01070}01070                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01071}01071                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01072}01072                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01073}01073                         error = EPERM;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01074}01074                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01075}01075 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01076}01076         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01077}01077                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01078}01078 \textcolor{stringliteral}{"{}\%s: \%s -\/ Invalid connection state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01079}01079                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01080}01080                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01081}01081         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01082}01082 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01083}01083         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01084}01084 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01085}01085         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01086}01086 \} \textcolor{comment}{/* ng\_hci\_lp\_con\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01087}01087 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01088}01088 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01089}01089 \textcolor{comment}{ * Send LP\_DisconnectInd to the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01090}01090 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01091}01091 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01092}01092 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01093}\mbox{\hyperlink{ng__hci__ulpi_8c_a5c014f20dea1cb50e4b6024465377b06}{01093}} \mbox{\hyperlink{ng__hci__ulpi_8c_a5c014f20dea1cb50e4b6024465377b06}{ng\_hci\_lp\_discon\_ind}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con, \textcolor{keywordtype}{int} reason)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01094}01094 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01095}01095         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01096}01096         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01097}01097         \mbox{\hyperlink{structng__hci__lp__discon__ind__ep}{ng\_hci\_lp\_discon\_ind\_ep}}  *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01098}01098         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01099}01099 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01100}01100         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01101}01101 \textcolor{comment}{         * Disconnect\_Complete event is generated for specific connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01102}01102 \textcolor{comment}{         * handle. For ACL connection handles both ACL and SCO upstream}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01103}01103 \textcolor{comment}{         * hooks will receive notification. For SCO connection handles}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01104}01104 \textcolor{comment}{         * only SCO upstream hook will receive notification.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01105}01105 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01106}01106 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01107}01107         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01108}01108                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01109}01109                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01110}01110                                 \mbox{\hyperlink{ng__hci_8h_ac300598519152aabd975bdcb85e7ee12}{NGM\_HCI\_LP\_DISCON\_IND}}, \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01111}01111                         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01112}01112                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01113}01113 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01114}01114                         ep = (\mbox{\hyperlink{structng__hci__lp__discon__ind__ep}{ng\_hci\_lp\_discon\_ind\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01115}01115                         ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a120ff39b6dfb58342e4f7136e5b8707c}{reason}} = reason;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01116}01116                         ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a27a6900f85a0eb110a539698597db483}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01117}01117                         ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a245d6ee6d9db7f0eeb5c470af1ef9e15}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01118}01118 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01119}01119                         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error,unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}},msg,unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}},0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01120}01120                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01121}01121                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01122}01122 \textcolor{stringliteral}{"{}\%s: \%s -\/ ACL hook is not connected or not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01123}01123                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01124}01124         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01125}01125 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01126}01126         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01127}01127                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_ac300598519152aabd975bdcb85e7ee12}{NGM\_HCI\_LP\_DISCON\_IND}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01128}01128                         \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01129}01129                 \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01130}01130                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01131}01131 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01132}01132                 ep = (\mbox{\hyperlink{structng__hci__lp__discon__ind__ep}{ng\_hci\_lp\_discon\_ind\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01133}01133                 ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a120ff39b6dfb58342e4f7136e5b8707c}{reason}} = reason;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01134}01134                 ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a27a6900f85a0eb110a539698597db483}{link\_type}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01135}01135                 ep-\/>\mbox{\hyperlink{structng__hci__lp__discon__ind__ep_a245d6ee6d9db7f0eeb5c470af1ef9e15}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01136}01136 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01137}01137                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg, unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01138}01138         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01139}01139                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01140}01140 \textcolor{stringliteral}{"{}\%s: \%s -\/ SCO hook is not connected or not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01141}01141                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01142}01142 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01143}01143         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01144}01144 \} \textcolor{comment}{/* ng\_hci\_lp\_discon\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01145}01145 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01146}01146 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01147}01147 \textcolor{comment}{ * Process LP\_QoSReq action from the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01148}01148 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01149}01149 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01150}01150 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01151}\mbox{\hyperlink{ng__hci__ulpi_8c_a08018734cbc9086c73490a02df9906b9}{01151}} \mbox{\hyperlink{ng__hci__ulpi_8c_a08018734cbc9086c73490a02df9906b9}{ng\_hci\_lp\_qos\_req}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01152}01152 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01153}01153         \textcolor{keyword}{struct }qos\_setup\_req \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01154}01154                 ng\_hci\_cmd\_pkt\_t         hdr;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01155}01155                 ng\_hci\_qos\_setup\_cp      cp;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01156}01156         \} \mbox{\hyperlink{ng__ubt__var_8h_a8e67811075b4fba1c03c4f250c77cd91}{\_\_attribute\_\_}} ((packed)) *req = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01157}01157         \mbox{\hyperlink{structng__hci__lp__qos__req__ep}{ng\_hci\_lp\_qos\_req\_ep}}                *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01158}01158         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}               con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01159}01159         \textcolor{keyword}{struct }mbuf                     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01160}01160         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01161}01161 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01162}01162         \textcolor{comment}{/* Check if unit is ready */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01163}01163         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) != \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01164}01164                 \mbox{\hyperlink{ng__hci__var_8h_add54db430ea340e556df410026a5c003}{NG\_HCI\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01165}01165 \textcolor{stringliteral}{"{}\%s: \%s -\/ unit is not ready, state=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01166}01166                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01167}01167 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01168}01168                 error = ENXIO;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01169}01169                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01170}01170         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01171}01171 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01172}01172         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen != \textcolor{keyword}{sizeof}(*ep)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01173}01173                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01174}01174 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid LP\_QoSSetupReq message size=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01175}01175                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01176}01176                         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01177}01177 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01178}01178                 error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01179}01179                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01180}01180         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01181}01181 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01182}01182         ep = (\mbox{\hyperlink{structng__hci__lp__qos__req__ep}{ng\_hci\_lp\_qos\_req\_ep}} *)(\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>data);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01183}01183 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01184}01184         con = \mbox{\hyperlink{ng__hci__misc_8c_a3b509cac93de160d32cdfb5a59ccff54}{ng\_hci\_con\_by\_handle}}(unit, ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a70d1a749fbeb823a42106f1ba89364aa}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01185}01185         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01186}01186                 \mbox{\hyperlink{ng__hci__var_8h_a347403c3d9eebde8aa890c65b4ab5874}{NG\_HCI\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01187}01187 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid connection handle=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01188}01188                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a70d1a749fbeb823a42106f1ba89364aa}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01189}01189 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01190}01190                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01191}01191                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01192}01192         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01193}01193 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01194}01194         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01195}01195                 \mbox{\hyperlink{ng__hci__var_8h_a347403c3d9eebde8aa890c65b4ab5874}{NG\_HCI\_ERR}}(\textcolor{stringliteral}{"{}\%s: \%s -\/ invalid link type=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01196}01196                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01197}01197 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01198}01198                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01199}01199                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01200}01200         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01201}01201 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01202}01202         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} != \mbox{\hyperlink{ng__hci_8h_a03025e63063d215be152dd1f8b86f199}{NG\_HCI\_CON\_OPEN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01203}01203                 \mbox{\hyperlink{ng__hci__var_8h_a347403c3d9eebde8aa890c65b4ab5874}{NG\_HCI\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01204}01204 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid connection state=\%d, handle=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01205}01205                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01206}01206                         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01207}01207 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01208}01208                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01209}01209                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01210}01210         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01211}01211 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01212}01212         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01213}01213 \textcolor{comment}{         * Create HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01214}01214 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01215}01215 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01216}01216         MGETHDR(m, M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01217}01217         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01218}01218                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01219}01219                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01220}01220         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01221}01221 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01222}01222         m-\/>m\_pkthdr.len = m-\/>m\_len = \textcolor{keyword}{sizeof}(*req);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01223}01223         req = mtod(m, \textcolor{keyword}{struct} qos\_setup\_req *);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01224}01224         req-\/>hdr.type = \mbox{\hyperlink{ng__hci_8h_a2530c45c7110ec470c215b4f1886c5ff}{NG\_HCI\_CMD\_PKT}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01225}01225         req-\/>hdr.length = \textcolor{keyword}{sizeof}(req-\/>cp);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01226}01226         req-\/>hdr.opcode = htole16(\mbox{\hyperlink{ng__hci_8h_aff633255c8eae43316635142208546f6}{NG\_HCI\_OPCODE}}(\mbox{\hyperlink{ng__hci_8h_a5d05ff53f900335f760745403437e11d}{NG\_HCI\_OGF\_LINK\_POLICY}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01227}01227                         \mbox{\hyperlink{ng__hci_8h_ae970e87a975a827064ccc7a514e5b90f}{NG\_HCI\_OCF\_QOS\_SETUP}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01228}01228 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01229}01229         req-\/>cp.con\_handle = htole16(ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a70d1a749fbeb823a42106f1ba89364aa}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01230}01230         req-\/>cp.flags = ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a2f05164224a434141397c231791de78f}{flags}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01231}01231         req-\/>cp.service\_type = ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_aaee22efe111dd23a6af7c2650cde18f6}{service\_type}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01232}01232         req-\/>cp.token\_rate = htole32(ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a122378067543357c49318a671d9573a2}{token\_rate}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01233}01233         req-\/>cp.peak\_bandwidth = htole32(ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a725810e5c6e6e48a5abd3a07df10c05d}{peak\_bandwidth}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01234}01234         req-\/>cp.latency = htole32(ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_a38d872d8add546b732a82c4d7d0d8f05}{latency}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01235}01235         req-\/>cp.delay\_variation = htole32(ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__req__ep_ab09ca259bd6a58273e9c23425e50713a}{delay\_variation}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01236}01236 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01237}01237         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01238}01238 \textcolor{comment}{         * Adjust connection state }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01239}01239 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01240}01240 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01241}01241         \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01242}01242                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01243}01243         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01244}01244                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01245}01245 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01246}01246         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01247}01247 \textcolor{comment}{         * Queue and send HCI command }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01248}01248 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01249}01249 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01250}01250         \mbox{\hyperlink{ng__bluetooth_8h_a4c6b5e44c71c672f0bb8b6338973a944}{NG\_BT\_MBUFQ\_ENQUEUE}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01251}01251         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01252}01252                 error = \mbox{\hyperlink{ng__hci__cmds_8c_a7b68579d8378fb89a0a3a1a07db0e387}{ng\_hci\_send\_command}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01253}01253 out:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01254}01254         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01255}01255 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01256}01256         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01257}01257 \} \textcolor{comment}{/* ng\_hci\_lp\_qos\_req */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01259}01259 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01260}01260 \textcolor{comment}{ * Send LP\_QoSCfm event to the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01261}01261 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01262}01262 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01263}01263 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01264}\mbox{\hyperlink{ng__hci__ulpi_8c_aecef55221eec735249ba0990e10a9a16}{01264}} \mbox{\hyperlink{ng__hci__ulpi_8c_aecef55221eec735249ba0990e10a9a16}{ng\_hci\_lp\_qos\_cfm}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}})}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01265}01265 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01266}01266         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01267}01267         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01268}01268         \mbox{\hyperlink{structng__hci__lp__qos__cfm__ep}{ng\_hci\_lp\_qos\_cfm\_ep}}        *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01269}01269         \textcolor{keywordtype}{int}                      error;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01270}01270 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01271}01271         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_a07ca755d6fa228bac40bdbb6cd151feb}{NG\_HCI\_CON\_NOTIFY\_ACL}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01272}01272                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01273}01273                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_accfad7a1d4f55c169e93f3ce78d76f7f}{NGM\_HCI\_LP\_QOS\_CFM}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01274}01274                                 \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01275}01275                         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01276}01276                                 ep = (\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep}{ng\_hci\_lp\_qos\_cfm\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01277}01277                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep_aa6bcd6b52b6ac51fa8af910fed83f286}{status}} = \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01278}01278                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep_a48c05c681285194ecc4a20976875463f}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01279}01279 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01280}01280                                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01281}01281                                         unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01282}01282                         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01283}01283                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01284}01284                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01285}01285 \textcolor{stringliteral}{"{}\%s: \%s -\/ ACL hook not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01286}01286                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01287}01287 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01288}01288                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_NOTIFY\_ACL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01289}01289         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01290}01290 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01291}01291         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_a507b8524d28b9fb46fd917ecad3c5e22}{NG\_HCI\_CON\_NOTIFY\_SCO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01292}01292                 \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01293}01293                         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_accfad7a1d4f55c169e93f3ce78d76f7f}{NGM\_HCI\_LP\_QOS\_CFM}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01294}01294                                 \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01295}01295                         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01296}01296                                 ep = (\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep}{ng\_hci\_lp\_qos\_cfm\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01297}01297                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep_aa6bcd6b52b6ac51fa8af910fed83f286}{status}} = \mbox{\hyperlink{ng__ubt__intel_8c_ade818037fd6c985038ff29656089758d}{status}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01298}01298                                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__cfm__ep_a48c05c681285194ecc4a20976875463f}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01299}01299 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01300}01300                                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg,}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01301}01301                                         unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01302}01302                         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01303}01303                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01304}01304                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01305}01305 \textcolor{stringliteral}{"{}\%s: \%s -\/ SCO hook not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01306}01306                                  \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01307}01307 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01308}01308                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_NOTIFY\_SCO;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01309}01309         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01310}01310 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01311}01311         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01312}01312 \} \textcolor{comment}{/* ng\_hci\_lp\_qos\_cfm */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01313}01313 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01314}01314 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01315}01315 \textcolor{comment}{ * Send LP\_QoSViolationInd event to the upper layer protocol}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01316}01316 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01317}01317 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01318}01318 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01319}\mbox{\hyperlink{ng__hci__ulpi_8c_ac3bd684213e259e7dac0782884fc3e6d}{01319}} \mbox{\hyperlink{ng__hci__ulpi_8c_ac3bd684213e259e7dac0782884fc3e6d}{ng\_hci\_lp\_qos\_ind}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01320}01320 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01321}01321         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01322}01322         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01323}01323         \mbox{\hyperlink{structng__hci__lp__qos__ind__ep}{ng\_hci\_lp\_qos\_ind\_ep}}        *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01324}01324         \textcolor{keywordtype}{int}                      error;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01325}01325 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01326}01326         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01327}01327 \textcolor{comment}{         * QoS Violation can only be generated for ACL connection handles.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01328}01328 \textcolor{comment}{         * Both ACL and SCO upstream hooks will receive notification.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01329}01329 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01330}01330 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01331}01331         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01332}01332                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_a1f94d4e5d166dfce39a71e0553a00187}{NGM\_HCI\_LP\_QOS\_IND}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01333}01333                         \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01334}01334                 \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01335}01335                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01336}01336 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01337}01337                 ep = (\mbox{\hyperlink{structng__hci__lp__qos__ind__ep}{ng\_hci\_lp\_qos\_ind\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01338}01338                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__ind__ep_ab474a92703ce54ff90a0beba3a016129}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01339}01339 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01340}01340                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg, unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01341}01341         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01342}01342                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01343}01343 \textcolor{stringliteral}{"{}\%s: \%s -\/ ACL hook is not connected or not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01344}01344                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01345}01345 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01346}01346         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01347}01347                 \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}}, \mbox{\hyperlink{ng__hci_8h_a1f94d4e5d166dfce39a71e0553a00187}{NGM\_HCI\_LP\_QOS\_IND}}, }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01348}01348                         \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01349}01349                 \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01350}01350                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01351}01351 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01352}01352                 ep = (\mbox{\hyperlink{structng__hci__lp__qos__ind__ep}{ng\_hci\_lp\_qos\_ind\_ep}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01353}01353                 ep-\/>\mbox{\hyperlink{structng__hci__lp__qos__ind__ep_ab474a92703ce54ff90a0beba3a016129}{con\_handle}} = con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01354}01354 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01355}01355                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, msg, unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01356}01356         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01357}01357                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01358}01358 \textcolor{stringliteral}{"{}\%s: \%s -\/ SCO hook is not connected or not valid, hook=\%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01359}01359                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01360}01360 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01361}01361         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01362}01362 \} \textcolor{comment}{/* ng\_hci\_lp\_qos\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01363}01363 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01364}01364 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01365}01365 \textcolor{comment}{ * Process connection timeout}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01366}01366 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01367}01367 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01368}01368 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01369}\mbox{\hyperlink{ng__hci__ulpi_8c_a82e1cb9b5e42bb451132a4fc1ed680d5}{01369}} \mbox{\hyperlink{ng__hci__ulpi_8c_a82e1cb9b5e42bb451132a4fc1ed680d5}{ng\_hci\_process\_con\_timeout}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void} *arg1, \textcolor{keywordtype}{int} con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01370}01370 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01371}01371         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}              unit = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01372}01372         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}      con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01373}01373 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01374}01374         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01375}01375                 printf(\textcolor{stringliteral}{"{}\%s: Netgraph node is not valid\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01376}01376                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01377}01377         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01378}01378 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01379}01379         unit = (\mbox{\hyperlink{ng__hci__var_8h_ae9ddc466aacad997aa8685ab61d77a56}{ng\_hci\_unit\_p}}) \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01380}01380         con = \mbox{\hyperlink{ng__hci__misc_8c_a3b509cac93de160d32cdfb5a59ccff54}{ng\_hci\_con\_by\_handle}}(unit, con\_handle);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01381}01381 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01382}01382         \textcolor{keywordflow}{if} (con == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01383}01383                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01384}01384 \textcolor{stringliteral}{"{}\%s: \%s -\/ could not find connection, handle=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01385}01385                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), con\_handle);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01386}01386                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01387}01387         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01388}01388 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01389}01389         \textcolor{keywordflow}{if} (!(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_ad12efc8076041274c18cd976c0004ef5}{NG\_HCI\_CON\_TIMEOUT\_PENDING}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01390}01390                 \mbox{\hyperlink{ng__hci__var_8h_a98c5548ff25cec6226d5624900801d5e}{NG\_HCI\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01391}01391 \textcolor{stringliteral}{"{}\%s: \%s -\/ no pending connection timeout, handle=\%d, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01392}01392                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), con\_handle, con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01393}01393                         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01394}01394                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01395}01395         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01396}01396 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01397}01397         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_TIMEOUT\_PENDING;}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01398}01398 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01399}01399         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01400}01400 \textcolor{comment}{         * We expect to receive connection timeout in one of the following}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01401}01401 \textcolor{comment}{         * states:}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01402}01402 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01403}01403 \textcolor{comment}{         * 1) NG\_HCI\_CON\_W4\_LP\_CON\_RSP means that upper layer has not responded}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01404}01404 \textcolor{comment}{         *    to our LP\_CON\_IND. Do nothing and destroy connection. Remote peer}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01405}01405 \textcolor{comment}{         *    most likely already gave up on us.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01406}01406 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01407}01407 \textcolor{comment}{         * 2) NG\_HCI\_CON\_W4\_CONN\_COMPLETE means upper layer requested connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01408}01408 \textcolor{comment}{         *    (or we in the process of accepting it) and baseband has timedout}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01409}01409 \textcolor{comment}{         *    on us. Inform upper layers and send LP\_CON\_CFM.}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01410}01410 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01411}01411 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01412}01412         \textcolor{keywordflow}{switch} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01413}01413         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_a525b11293791d61d7d5331ea55917c36}{NG\_HCI\_CON\_W4\_LP\_CON\_RSP}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01414}01414                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01415}01415 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01416}01416         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hci_8h_aed2c55be75b962b9cab878e3cc421860}{NG\_HCI\_CON\_W4\_CONN\_COMPLETE}}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01417}01417                 \mbox{\hyperlink{ng__hci__ulpi_8c_a771e897a940d04cdff7f91354b165f39}{ng\_hci\_lp\_con\_cfm}}(con, 0xee);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01418}01418                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01419}01419 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01420}01420         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01421}01421                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01422}01422 \textcolor{stringliteral}{"{}\%s: \%s -\/ Invalid connection state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01423}01423                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}});}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01424}01424                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01425}01425         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01426}01426 }
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01427}01427         \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__ulpi_8c_source_l01428}01428 \} \textcolor{comment}{/* ng\_hci\_process\_con\_timeout */}}

\end{DoxyCode}
