\hypertarget{cp2112_8c_source}{}\doxysection{cp2112.\+c}
\label{cp2112_8c_source}\index{dev/usb/misc/cp2112.c@{dev/usb/misc/cp2112.c}}
\mbox{\hyperlink{cp2112_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) Andriy Gapon}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00006}00006 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00007}00007 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00008}00008 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00009}00009 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions, and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00011}00011 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00013}00013 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00014}00014 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00015}00015 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00016}00016 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00017}00017 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00018}00018 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00019}00019 \textcolor{comment}{ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00020}00020 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00021}00021 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00022}00022 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00023}00023 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00024}00024 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00025}00025 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00026}00026 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00029}00029 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00030}00030 \textcolor{comment}{ * Hardware information links:}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00031}00031 \textcolor{comment}{ * -\/ CP2112 Datasheet}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00032}00032 \textcolor{comment}{ *   https://www.silabs.com/documents/public/data-\/sheets/cp2112-\/datasheet.pdf}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00033}00033 \textcolor{comment}{ * -\/ AN495: CP2112 Interface Specification}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00034}00034 \textcolor{comment}{ *   https://www.silabs.com/documents/public/application-\/notes/an495-\/cp2112-\/interface-\/specification.pdf}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00035}00035 \textcolor{comment}{ * -\/ CP2112 Errata}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00036}00036 \textcolor{comment}{ *   https://www.silabs.com/documents/public/errata/cp2112-\/errata.pdf}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00037}00037 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00038}00038 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00040}\mbox{\hyperlink{cp2112_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00040}} \mbox{\hyperlink{cp2112_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/condvar.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/gpio.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/sdt.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/sx.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <dev/gpio/gpiobusvar.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <dev/iicbus/iiconf.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <dev/iicbus/iicbus.h>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00058}00058 \textcolor{preprocessor}{\#include "{}iicbus\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb_8h}{dev/usb/usb.h}}>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi_8h}{dev/usb/usbdi.h}}>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi__util_8h}{dev/usb/usbdi\_util.h}}>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbhid_8h}{dev/usb/usbhid.h}}>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00064}00064 \textcolor{preprocessor}{\#include "{}usbdevs.h"{}}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00066}\mbox{\hyperlink{cp2112_8c_a927dd6f59caf10a2991dfb564bcbb1e1}{00066}} \textcolor{preprocessor}{\#define USB\_DEBUG\_VAR usb\_debug}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00067}00067 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__debug_8h}{dev/usb/usb\_debug.h}}>}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00069}\mbox{\hyperlink{cp2112_8c_a9620a0a04f93688ff7cecbf9fdb050ec}{00069}} \textcolor{preprocessor}{\#define SIZEOF\_FIELD(\_s, \_f)    sizeof(((struct \_s *)NULL)-\/>\_f)}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00071}\mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{00071}} \textcolor{preprocessor}{\#define CP2112GPIO\_LOCK(sc)     sx\_xlock(\&sc-\/>gpio\_lock)}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00072}\mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{00072}} \textcolor{preprocessor}{\#define CP2112GPIO\_UNLOCK(sc)   sx\_xunlock(\&sc-\/>gpio\_lock)}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00073}\mbox{\hyperlink{cp2112_8c_a0c4677f38dc122f687944e668a55426a}{00073}} \textcolor{preprocessor}{\#define CP2112GPIO\_LOCKED(sc)   sx\_assert(\&sc-\/>gpio\_lock, SX\_XLOCKED)}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00074}00074 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00075}\mbox{\hyperlink{cp2112_8c_a7419d8aeec03a5304e9ba8f3e30a0c00}{00075}} \textcolor{preprocessor}{\#define CP2112\_PART\_NUM                 0x0c}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00076}\mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{00076}} \textcolor{preprocessor}{\#define CP2112\_GPIO\_COUNT               8}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00077}\mbox{\hyperlink{cp2112_8c_ad1d8ef9bded33674abc3ced1ae147f0f}{00077}} \textcolor{preprocessor}{\#define CP2112\_REPORT\_SIZE              64}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00079}\mbox{\hyperlink{cp2112_8c_aeeeb93bb7e2c0319ae6bbdf698d97fab}{00079}} \textcolor{preprocessor}{\#define CP2112\_REQ\_RESET                0x1}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00080}\mbox{\hyperlink{cp2112_8c_aea3c91437c30c4079cc1a8c3fbbcb595}{00080}} \textcolor{preprocessor}{\#define CP2112\_REQ\_GPIO\_CFG             0x2}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00081}\mbox{\hyperlink{cp2112_8c_acfec7998153f115adeced0e416fe427f}{00081}} \textcolor{preprocessor}{\#define CP2112\_REQ\_GPIO\_GET             0x3}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00082}\mbox{\hyperlink{cp2112_8c_ab7e3bc65d83eef196c0b72b49efb50c1}{00082}} \textcolor{preprocessor}{\#define CP2112\_REQ\_GPIO\_SET             0x4}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00083}\mbox{\hyperlink{cp2112_8c_ad123e7cfb1d3420b46681e74ce8f2074}{00083}} \textcolor{preprocessor}{\#define CP2112\_REQ\_VERSION              0x5}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00084}\mbox{\hyperlink{cp2112_8c_a1c78467d71e5b56ab9c83c2834c17971}{00084}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_CFG              0x6}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00086}\mbox{\hyperlink{cp2112_8c_ab20d89c310af6f6e4024892a21c14da6}{00086}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_READ             0x10}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00087}\mbox{\hyperlink{cp2112_8c_aac18fb1aaa5922dd3137040c81a16760}{00087}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_WRITE\_READ       0x11}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00088}\mbox{\hyperlink{cp2112_8c_a08e8e6ba84e1ac69e7adcfb595c98531}{00088}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_READ\_FORCE\_SEND  0x12}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00089}\mbox{\hyperlink{cp2112_8c_a814f2ae1dfabb7becd917ae33b976cf5}{00089}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_READ\_RESPONSE    0x13}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00090}\mbox{\hyperlink{cp2112_8c_a4633c18b15a478f4498c218538eea66b}{00090}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_WRITE            0x14}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00091}\mbox{\hyperlink{cp2112_8c_aadceaa19140c954a0679e3cc9eddafc7}{00091}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_XFER\_STATUS\_REQ  0x15}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00092}\mbox{\hyperlink{cp2112_8c_aea687eefe424d6a990d69c4650b027f0}{00092}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_XFER\_STATUS\_RESP 0x16}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00093}\mbox{\hyperlink{cp2112_8c_a2999ddb1802450f78d17a122da61cc74}{00093}} \textcolor{preprocessor}{\#define CP2112\_REQ\_SMB\_CANCEL           0x17}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00095}\mbox{\hyperlink{cp2112_8c_a015ba483d5f592131105d006bfec59b5}{00095}} \textcolor{preprocessor}{\#define CP2112\_REQ\_LOCK                 0x20}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00096}\mbox{\hyperlink{cp2112_8c_a9fecfb25c5cefb103cd11eca5db60e52}{00096}} \textcolor{preprocessor}{\#define CP2112\_REQ\_USB\_CFG              0x21}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00098}\mbox{\hyperlink{cp2112_8c_a8dd60de7021c6f4585468ce873daac1e}{00098}} \textcolor{preprocessor}{\#define CP2112\_IIC\_MAX\_READ\_LEN         512}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00099}\mbox{\hyperlink{cp2112_8c_abc69ffca62dac7e7213a5f84a8de1d0c}{00099}} \textcolor{preprocessor}{\#define CP2112\_IIC\_REPSTART\_VER         2       }\textcolor{comment}{/* Erratum CP2112\_E10. */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00101}\mbox{\hyperlink{cp2112_8c_ad32117c1f3e873292a0670853f1eceb3}{00101}} \textcolor{preprocessor}{\#define CP2112\_GPIO\_SPEC\_CLK7           1       }\textcolor{comment}{/* Pin 7 is clock output. */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00102}\mbox{\hyperlink{cp2112_8c_a1cd9a1ed609492f3f5404139fdae809e}{00102}} \textcolor{preprocessor}{\#define CP2112\_GPIO\_SPEC\_TX0            2       }\textcolor{comment}{/* Pin 0 pulses on USB TX. */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00103}\mbox{\hyperlink{cp2112_8c_ae36537514addce4395f22bbbb5562ca6}{00103}} \textcolor{preprocessor}{\#define CP2112\_GPIO\_SPEC\_RX1            4       }\textcolor{comment}{/* Pin 1 pulses on USB RX. */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00105}\mbox{\hyperlink{cp2112_8c_aebc2dbaa2ccb5e02d8e3198c87a39416}{00105}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS0\_IDLE         0}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00106}\mbox{\hyperlink{cp2112_8c_a5ae19c726ff1af11f4cb155f0a0e7dab}{00106}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS0\_BUSY         1}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00107}\mbox{\hyperlink{cp2112_8c_aa285367f21ade6d11c525e34dc50a49e}{00107}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS0\_CMP          2}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00108}\mbox{\hyperlink{cp2112_8c_a99336d9f1a715ce8b45d89a1cdfe3446}{00108}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS0\_ERROR        3}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00110}\mbox{\hyperlink{cp2112_8c_afdec84e67b0442ba2c0ee553f5a4f83f}{00110}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS1\_TIMEOUT\_NACK 0}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00111}\mbox{\hyperlink{cp2112_8c_ac97bd415d65dd5e519c304717addd9be}{00111}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS1\_TIMEOUT\_BUS  1}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00112}\mbox{\hyperlink{cp2112_8c_a0ab4546053a0dc49b73bedc90ace6594}{00112}} \textcolor{preprocessor}{\#define CP2112\_IIC\_STATUS1\_ARB\_LOST     2}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00114}00114 \textcolor{comment}{/* CP2112\_REQ\_VERSION */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00115}\mbox{\hyperlink{structversion__request}{00115}} \textcolor{keyword}{struct }\mbox{\hyperlink{structversion__request}{version\_request}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00116}\mbox{\hyperlink{structversion__request_af285f2751c7a721a9d235e67352b844c}{00116}}         uint8\_t \mbox{\hyperlink{structversion__request_af285f2751c7a721a9d235e67352b844c}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00117}\mbox{\hyperlink{structversion__request_aef571171be4c536a2eeaec0333e8553e}{00117}}         uint8\_t \mbox{\hyperlink{structversion__request_aef571171be4c536a2eeaec0333e8553e}{part\_num}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00118}\mbox{\hyperlink{structversion__request_a6e99b2747c37d019a4150d1cb9eb92b3}{00118}}         uint8\_t \mbox{\hyperlink{structversion__request_a6e99b2747c37d019a4150d1cb9eb92b3}{version}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00119}\mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{00119}} \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00121}00121 \textcolor{comment}{/* CP2112\_REQ\_GPIO\_GET */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00122}\mbox{\hyperlink{structgpio__get__req}{00122}} \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__get__req}{gpio\_get\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00123}\mbox{\hyperlink{structgpio__get__req_ab431912a03a26a989b9ab43933dec414}{00123}}         uint8\_t \mbox{\hyperlink{structgpio__get__req_ab431912a03a26a989b9ab43933dec414}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00124}\mbox{\hyperlink{structgpio__get__req_ac6adb5c9998696062dfd1a21e1623d7c}{00124}}         uint8\_t \mbox{\hyperlink{structgpio__get__req_ac6adb5c9998696062dfd1a21e1623d7c}{state}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00125}00125 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00126}00126 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00127}00127 \textcolor{comment}{/* CP2112\_REQ\_GPIO\_SET */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00128}\mbox{\hyperlink{structgpio__set__req}{00128}} \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__set__req}{gpio\_set\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00129}\mbox{\hyperlink{structgpio__set__req_abb100bc260e63f8b4200a3651a43c980}{00129}}         uint8\_t \mbox{\hyperlink{structgpio__set__req_abb100bc260e63f8b4200a3651a43c980}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00130}\mbox{\hyperlink{structgpio__set__req_ac2b108b256638ddad379a36f4b929905}{00130}}         uint8\_t \mbox{\hyperlink{structgpio__set__req_ac2b108b256638ddad379a36f4b929905}{state}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00131}\mbox{\hyperlink{structgpio__set__req_a5ae77b017a7c0b46d25d2dc6bceab030}{00131}}         uint8\_t \mbox{\hyperlink{structgpio__set__req_a5ae77b017a7c0b46d25d2dc6bceab030}{mask}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00132}00132 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00134}00134 \textcolor{comment}{/* CP2112\_REQ\_GPIO\_CFG */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00135}\mbox{\hyperlink{structgpio__config__req}{00135}} \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__config__req}{gpio\_config\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00136}\mbox{\hyperlink{structgpio__config__req_a2dd233e002b85817bb825fd8b29d56ec}{00136}}         uint8\_t \mbox{\hyperlink{structgpio__config__req_a2dd233e002b85817bb825fd8b29d56ec}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00137}\mbox{\hyperlink{structgpio__config__req_a4e57a20be65d8791611af8f440f95bc7}{00137}}         uint8\_t \mbox{\hyperlink{structgpio__config__req_a4e57a20be65d8791611af8f440f95bc7}{output}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00138}\mbox{\hyperlink{structgpio__config__req_a848749a463e1e5b4170a048881fd3678}{00138}}         uint8\_t \mbox{\hyperlink{structgpio__config__req_a848749a463e1e5b4170a048881fd3678}{pushpull}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00139}\mbox{\hyperlink{structgpio__config__req_ac7a0b7d9f5b65244dd3ed1fc332083a2}{00139}}         uint8\_t \mbox{\hyperlink{structgpio__config__req_ac7a0b7d9f5b65244dd3ed1fc332083a2}{special}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00140}\mbox{\hyperlink{structgpio__config__req_ad11f4fb6dc1e5030da6e05fd31527d63}{00140}}         uint8\_t \mbox{\hyperlink{structgpio__config__req_ad11f4fb6dc1e5030da6e05fd31527d63}{divider}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00141}00141 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00143}00143 \textcolor{comment}{/* CP2112\_REQ\_SMB\_XFER\_STATUS\_REQ */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00144}\mbox{\hyperlink{structi2c__xfer__status__req}{00144}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__xfer__status__req}{i2c\_xfer\_status\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00145}\mbox{\hyperlink{structi2c__xfer__status__req_a2411bab86e7b14355c4c57a460373e74}{00145}}         uint8\_t \mbox{\hyperlink{structi2c__xfer__status__req_a2411bab86e7b14355c4c57a460373e74}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00146}\mbox{\hyperlink{structi2c__xfer__status__req_af9cb9262f09988ccc4cd09db3bcee41d}{00146}}         uint8\_t \mbox{\hyperlink{structi2c__xfer__status__req_af9cb9262f09988ccc4cd09db3bcee41d}{request}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00147}00147 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00149}00149 \textcolor{comment}{/* CP2112\_REQ\_SMB\_XFER\_STATUS\_RESP */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00150}\mbox{\hyperlink{structi2c__xfer__status__resp}{00150}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__xfer__status__resp}{i2c\_xfer\_status\_resp}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00151}\mbox{\hyperlink{structi2c__xfer__status__resp_a73da01b3ec254ba27d2897a503c8eaa2}{00151}}         uint8\_t \mbox{\hyperlink{structi2c__xfer__status__resp_a73da01b3ec254ba27d2897a503c8eaa2}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00152}\mbox{\hyperlink{structi2c__xfer__status__resp_a2df5b84ebf8fd93a363ba55d45e28173}{00152}}         uint8\_t \mbox{\hyperlink{structi2c__xfer__status__resp_a2df5b84ebf8fd93a363ba55d45e28173}{status0}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00153}\mbox{\hyperlink{structi2c__xfer__status__resp_a8ce3a6327e9d79a753b6dd4bb11817a2}{00153}}         uint8\_t \mbox{\hyperlink{structi2c__xfer__status__resp_a8ce3a6327e9d79a753b6dd4bb11817a2}{status1}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00154}\mbox{\hyperlink{structi2c__xfer__status__resp_a951aab5feaefa9094f62841c1f0cf5ed}{00154}}         uint16\_t \mbox{\hyperlink{structi2c__xfer__status__resp_a951aab5feaefa9094f62841c1f0cf5ed}{status2}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00155}\mbox{\hyperlink{structi2c__xfer__status__resp_ac44e297be56fc2058f9af301a19699ac}{00155}}         uint16\_t \mbox{\hyperlink{structi2c__xfer__status__resp_ac44e297be56fc2058f9af301a19699ac}{status3}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00156}00156 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00157}00157 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00158}00158 \textcolor{comment}{/* CP2112\_REQ\_SMB\_READ\_FORCE\_SEND */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00159}\mbox{\hyperlink{structi2c__data__read__force__send__req}{00159}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__data__read__force__send__req}{i2c\_data\_read\_force\_send\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00160}\mbox{\hyperlink{structi2c__data__read__force__send__req_aa2e6ce229ee23709be9d73122445009c}{00160}}         uint8\_t \mbox{\hyperlink{structi2c__data__read__force__send__req_aa2e6ce229ee23709be9d73122445009c}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00161}\mbox{\hyperlink{structi2c__data__read__force__send__req_ae4ceba06c96f1014f348246b9656eeff}{00161}}         uint16\_t \mbox{\hyperlink{structi2c__data__read__force__send__req_ae4ceba06c96f1014f348246b9656eeff}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00162}00162 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00163}00163 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00164}00164 \textcolor{comment}{/* CP2112\_REQ\_SMB\_READ\_RESPONSE */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00165}\mbox{\hyperlink{structi2c__data__read__resp}{00165}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__data__read__resp}{i2c\_data\_read\_resp}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00166}\mbox{\hyperlink{structi2c__data__read__resp_afca97bbc7754877125a7fb23e3edf89f}{00166}}         uint8\_t \mbox{\hyperlink{structi2c__data__read__resp_afca97bbc7754877125a7fb23e3edf89f}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00167}\mbox{\hyperlink{structi2c__data__read__resp_a9eb6978e81a1cd12bea358fc8d5c0347}{00167}}         uint8\_t \mbox{\hyperlink{structi2c__data__read__resp_a9eb6978e81a1cd12bea358fc8d5c0347}{status}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00168}\mbox{\hyperlink{structi2c__data__read__resp_a4cd56f72fe44e4049b65cd00063a4ee8}{00168}}         uint8\_t \mbox{\hyperlink{structi2c__data__read__resp_a4cd56f72fe44e4049b65cd00063a4ee8}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00169}\mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{00169}}         uint8\_t \mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{data}}[61];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00170}00170 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00171}00171 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00172}00172 \textcolor{comment}{/* CP2112\_REQ\_SMB\_READ */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00173}\mbox{\hyperlink{structi2c__write__read__req}{00173}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__write__read__req}{i2c\_write\_read\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00174}\mbox{\hyperlink{structi2c__write__read__req_aa27c55a05997f37933975c590aa3cbcc}{00174}}         uint8\_t \mbox{\hyperlink{structi2c__write__read__req_aa27c55a05997f37933975c590aa3cbcc}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00175}\mbox{\hyperlink{structi2c__write__read__req_a014564c8b457555f8e76ddf1608647ee}{00175}}         uint8\_t \mbox{\hyperlink{structi2c__write__read__req_a014564c8b457555f8e76ddf1608647ee}{slave}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00176}\mbox{\hyperlink{structi2c__write__read__req_a5e537bd0cc92a99b8e36a399c1b2d272}{00176}}         uint16\_t \mbox{\hyperlink{structi2c__write__read__req_a5e537bd0cc92a99b8e36a399c1b2d272}{rlen}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00177}\mbox{\hyperlink{structi2c__write__read__req_aceece24b7b05d90c2e38ce184e3166b3}{00177}}         uint8\_t \mbox{\hyperlink{structi2c__write__read__req_aceece24b7b05d90c2e38ce184e3166b3}{wlen}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00178}\mbox{\hyperlink{structi2c__write__read__req_a13fa5e15d25ad0a379e98c53d307a706}{00178}}         uint8\_t \mbox{\hyperlink{structi2c__write__read__req_a13fa5e15d25ad0a379e98c53d307a706}{wdata}}[16];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00179}00179 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00181}00181 \textcolor{comment}{/* CP2112\_REQ\_SMB\_WRITE */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00182}\mbox{\hyperlink{structi2c__read__req}{00182}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__read__req}{i2c\_read\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00183}\mbox{\hyperlink{structi2c__read__req_adf7d3c18e8d9ed8af45385ae01827948}{00183}}         uint8\_t \mbox{\hyperlink{structi2c__read__req_adf7d3c18e8d9ed8af45385ae01827948}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00184}\mbox{\hyperlink{structi2c__read__req_a2052f3dcbd5a3ef59922ad879d6ce540}{00184}}         uint8\_t \mbox{\hyperlink{structi2c__read__req_a2052f3dcbd5a3ef59922ad879d6ce540}{slave}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00185}\mbox{\hyperlink{structi2c__read__req_a48171e2869c7b90cb822bb2ea25f6914}{00185}}         uint16\_t \mbox{\hyperlink{structi2c__read__req_a48171e2869c7b90cb822bb2ea25f6914}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00186}00186 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00187}00187 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00188}00188 \textcolor{comment}{/* CP2112\_REQ\_SMB\_WRITE\_READ */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00189}\mbox{\hyperlink{structi2c__write__req}{00189}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__write__req}{i2c\_write\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00190}\mbox{\hyperlink{structi2c__write__req_a12284da6117ce2a8fedc331fd5406d5c}{00190}}         uint8\_t \mbox{\hyperlink{structi2c__write__req_a12284da6117ce2a8fedc331fd5406d5c}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00191}\mbox{\hyperlink{structi2c__write__req_afd9bf2cae503df743c3a759f4121c2b6}{00191}}         uint8\_t \mbox{\hyperlink{structi2c__write__req_afd9bf2cae503df743c3a759f4121c2b6}{slave}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00192}\mbox{\hyperlink{structi2c__write__req_a3f31b643ef3293eaa7375f1e907134a3}{00192}}         uint8\_t \mbox{\hyperlink{structi2c__write__req_a3f31b643ef3293eaa7375f1e907134a3}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00193}\mbox{\hyperlink{structi2c__write__req_a9d071a6ed09e4e97fc9275139aa107ca}{00193}}         uint8\_t \mbox{\hyperlink{structi2c__write__req_a9d071a6ed09e4e97fc9275139aa107ca}{data}}[61];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00194}00194 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00195}00195 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00196}00196 \textcolor{comment}{/* CP2112\_REQ\_SMB\_CFG */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00197}\mbox{\hyperlink{structi2c__cfg__req}{00197}} \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__cfg__req}{i2c\_cfg\_req}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00198}\mbox{\hyperlink{structi2c__cfg__req_aa1db5ed107f817851404e1325c815673}{00198}}         uint8\_t         \mbox{\hyperlink{structi2c__cfg__req_aa1db5ed107f817851404e1325c815673}{id}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00199}\mbox{\hyperlink{structi2c__cfg__req_ae619f54cb21051410e8d27859b885b0c}{00199}}         uint32\_t        \mbox{\hyperlink{structi2c__cfg__req_ae619f54cb21051410e8d27859b885b0c}{speed}};             \textcolor{comment}{/* Hz */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00200}\mbox{\hyperlink{structi2c__cfg__req_aef7758e747c00b5a4f4ababd65a47f19}{00200}}         uint8\_t         \mbox{\hyperlink{structi2c__cfg__req_aef7758e747c00b5a4f4ababd65a47f19}{slave\_addr}};   \textcolor{comment}{/* ACK only */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00201}\mbox{\hyperlink{structi2c__cfg__req_aa9df786cbc9fdb87382ecbf07147266e}{00201}}         uint8\_t         \mbox{\hyperlink{structi2c__cfg__req_aa9df786cbc9fdb87382ecbf07147266e}{auto\_send\_read}};   \textcolor{comment}{/* boolean */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00202}\mbox{\hyperlink{structi2c__cfg__req_a1ebe28ed7fa2ccd18d74d1e8a3cfb0ea}{00202}}         uint16\_t        \mbox{\hyperlink{structi2c__cfg__req_a1ebe28ed7fa2ccd18d74d1e8a3cfb0ea}{write\_timeout}};     \textcolor{comment}{/* 0-\/1000 ms, 0 \string~ no timeout */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00203}\mbox{\hyperlink{structi2c__cfg__req_a589601b9abe86d915fdbb5e6b7cb8fb7}{00203}}         uint16\_t        \mbox{\hyperlink{structi2c__cfg__req_a589601b9abe86d915fdbb5e6b7cb8fb7}{read\_timeout}};       \textcolor{comment}{/* 0-\/1000 ms, 0 \string~ no timeout */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00204}\mbox{\hyperlink{structi2c__cfg__req_a26470088f4dea9f55c7b83a6b04dae0a}{00204}}         uint8\_t         \mbox{\hyperlink{structi2c__cfg__req_a26470088f4dea9f55c7b83a6b04dae0a}{scl\_low\_timeout}};\textcolor{comment}{/* boolean */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00205}\mbox{\hyperlink{structi2c__cfg__req_a8682f8dee30b81bfaa1d8e51ce554ff5}{00205}}         uint16\_t        \mbox{\hyperlink{structi2c__cfg__req_a8682f8dee30b81bfaa1d8e51ce554ff5}{retry\_count}}; \textcolor{comment}{/* 1-\/1000, 0 \string~ forever */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00206}00206 \} \mbox{\hyperlink{cp2112_8c_aa10bf1ab08a1c879edf12d2ad660c73b}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00207}00207 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00208}\mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0}{00208}} \textcolor{keyword}{enum} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0}{cp2112\_out\_mode}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00209}\mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{00209}}         \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00210}\mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{00210}}         \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{OUT\_PP}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00211}00211         \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0ae047f0e12d77dfaa46dcd66c151b2330}{OUT\_KEEP}}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00212}\mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0ae047f0e12d77dfaa46dcd66c151b2330}{00212}} \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00213}00213 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00214}00214 \textcolor{keyword}{enum} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00215}\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960aeee5d47940c01d494c6203fdf8faceb3}{00215}}         \mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960aeee5d47940c01d494c6203fdf8faceb3}{CP2112\_INTR\_OUT}} = 0,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00216}\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960ab0e5946c830725cdfb66451d703f0aad}{00216}}         \mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960ab0e5946c830725cdfb66451d703f0aad}{CP2112\_INTR\_IN}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00217}\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960a5f0ca3b238b86fd4ae1ca1cfc3ebb3fd}{00217}}         \mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960a5f0ca3b238b86fd4ae1ca1cfc3ebb3fd}{CP2112\_N\_TRANSFER}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00218}00218 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00219}00219 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00220}\mbox{\hyperlink{structcp2112__softc}{00220}} \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00221}\mbox{\hyperlink{structcp2112__softc_aa428c67b8d83ce52e7620bfcf005b0ce}{00221}}         device\_t                \mbox{\hyperlink{structcp2112__softc_aa428c67b8d83ce52e7620bfcf005b0ce}{sc\_gpio\_dev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00222}\mbox{\hyperlink{structcp2112__softc_ae1dcd00e4713f6b1b5231f673ffe398b}{00222}}         device\_t                \mbox{\hyperlink{structcp2112__softc_ae1dcd00e4713f6b1b5231f673ffe398b}{sc\_iic\_dev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00223}\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{00223}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}}     *\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{sc\_udev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00224}\mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{00224}}         uint8\_t                 \mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{sc\_iface\_index}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00225}\mbox{\hyperlink{structcp2112__softc_a79bafd6db686b4f1e46c969fa2944b95}{00225}}         uint8\_t                 \mbox{\hyperlink{structcp2112__softc_a79bafd6db686b4f1e46c969fa2944b95}{sc\_version}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00226}00226 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00227}00227 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00228}\mbox{\hyperlink{structcp2112gpio__softc}{00228}} \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00229}\mbox{\hyperlink{structcp2112gpio__softc_aa1ea8eb8bc08e5e0d931f17478be07e0}{00229}}         \textcolor{keyword}{struct }sx               \mbox{\hyperlink{structcp2112gpio__softc_aa1ea8eb8bc08e5e0d931f17478be07e0}{gpio\_lock}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00230}\mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{00230}}         device\_t                \mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{busdev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00231}\mbox{\hyperlink{structcp2112gpio__softc_a009864b0349da13fab18f8c2de32ad6f}{00231}}         \textcolor{keywordtype}{int}                     \mbox{\hyperlink{structcp2112gpio__softc_a009864b0349da13fab18f8c2de32ad6f}{gpio\_caps}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00232}\mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{00232}}         \textcolor{keyword}{struct }gpio\_pin         \mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{pins}}[\mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}}];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00233}00233 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00234}00234 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00235}\mbox{\hyperlink{structcp2112iic__softc}{00235}} \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00236}\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{00236}}         device\_t        \mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00237}\mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{00237}}         device\_t        \mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{iicbus\_dev}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00238}\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{00238}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960a5f0ca3b238b86fd4ae1ca1cfc3ebb3fd}{CP2112\_N\_TRANSFER}}];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00239}\mbox{\hyperlink{structcp2112iic__softc_aa01804296247fc4cc743ca7d980054bd}{00239}}         u\_char          \mbox{\hyperlink{structcp2112iic__softc_aa01804296247fc4cc743ca7d980054bd}{own\_addr}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00240}00240         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00241}\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{00241}}                 \textcolor{keyword}{struct }mtx      \mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00242}\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{00242}}                 \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}}     \mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00243}00243                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00244}\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{00244}}                         uint8\_t         *\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00245}\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{00245}}                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00246}\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{00246}}                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00247}\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{00247}}                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00248}\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{00248}}                 \}               \mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00249}00249                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00250}\mbox{\hyperlink{structcp2112iic__softc_a2cd8e52392050376bafdcbe09615e6d8}{00250}}                         \textcolor{keyword}{const} uint8\_t   *\mbox{\hyperlink{structcp2112iic__softc_a2cd8e52392050376bafdcbe09615e6d8}{data}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00251}00251                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00252}00252                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00253}00253                         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00254}\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{00254}}                 \}               \mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00255}\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{00255}}         \}               \mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00256}00256 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00258}00258 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{cp2112_8c_a8d7ee9e941c9cbb64979b629377ed2a3}{cp2112\_detach}}(device\_t dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00259}00259 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{cp2112_8c_a4aacf543706ef16a5823afb7a18367bc}{cp2112gpio\_detach}}(device\_t dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00260}00260 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{cp2112_8c_ab8d54b635aec2e2eecd69f310b7259e3}{cp2112iic\_detach}}(device\_t dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00261}00261 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00262}\mbox{\hyperlink{cp2112_8c_a4b1d318edb805e5c790f81678770b524}{00262}} \textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{usbdi_8h_acf836fd8d6349b66a31f45420728da8d}{STRUCT\_USB\_HOST\_ID}} \mbox{\hyperlink{cp2112_8c_a4b1d318edb805e5c790f81678770b524}{cp2112\_devs}}[] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00263}00263         \{ \mbox{\hyperlink{usbdi_8h_a5b31cb666de14c80efa3edbce7f5ae19}{USB\_VP}}(USB\_VENDOR\_SILABS, USB\_PRODUCT\_SILABS\_CP2112) \},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00264}00264         \{ \mbox{\hyperlink{usbdi_8h_a5b31cb666de14c80efa3edbce7f5ae19}{USB\_VP}}(0x1009, USB\_PRODUCT\_SILABS\_CP2112) \}, \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00265}00265 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00266}00266 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00267}00267 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00268}\mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{00268}} \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(device\_t dev, uint8\_t \textcolor{keywordtype}{id}, \textcolor{keywordtype}{void} *data, uint16\_t \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00269}00269 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00270}00270         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00271}00271         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00273}00273         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00274}00274         err = \mbox{\hyperlink{usb__request_8c_ac0b19f45e28e829a7bb513957171bbe7}{usbd\_req\_get\_report}}(sc-\/>\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{sc\_udev}}, NULL, data,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00275}00275             \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}}, sc-\/>\mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{sc\_iface\_index}}, \mbox{\hyperlink{usbhid_8h_a2b39f0f97bf832c66dad0c7dc051b314}{UHID\_FEATURE\_REPORT}}, \textcolor{keywordtype}{id});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00276}00276         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00277}00277 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00279}00279 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00280}\mbox{\hyperlink{cp2112_8c_a6e1333c75ff8cf84cafda710aeb1e37c}{00280}} \mbox{\hyperlink{cp2112_8c_a6e1333c75ff8cf84cafda710aeb1e37c}{cp2112\_set\_report}}(device\_t dev, uint8\_t \textcolor{keywordtype}{id}, \textcolor{keywordtype}{void} *data, uint16\_t \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00281}00281 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00282}00282         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00283}00283         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00285}00285         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00286}00286         *(uint8\_t *)data = \textcolor{keywordtype}{id};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00287}00287         err = \mbox{\hyperlink{usb__request_8c_aa80da0d45171e70f02698c8adaf8e96e}{usbd\_req\_set\_report}}(sc-\/>\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{sc\_udev}}, NULL, data,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00288}00288             \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}}, sc-\/>\mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{sc\_iface\_index}}, \mbox{\hyperlink{usbhid_8h_a2b39f0f97bf832c66dad0c7dc051b314}{UHID\_FEATURE\_REPORT}}, \textcolor{keywordtype}{id});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00289}00289         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00290}00290 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00291}00291 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00292}00292 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00293}\mbox{\hyperlink{cp2112_8c_a8fca9d3fa35e4dfa0baac6ad08317bcf}{00293}} \mbox{\hyperlink{cp2112_8c_a8fca9d3fa35e4dfa0baac6ad08317bcf}{cp2112\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00294}00294 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00295}00295         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__attach__arg}{usb\_attach\_arg}} *uaa;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00296}00296 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00297}00297         uaa = device\_get\_ivars(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00298}00298         \textcolor{keywordflow}{if} (uaa-\/>\mbox{\hyperlink{structusb__attach__arg_a246691e99681281d3113d63e81b7e4f0}{usb\_mode}} != \mbox{\hyperlink{usb_8h_a9bc559812598988121896dceb483806ba1c7091216cfa9c9f4a252b0825ed32cb}{USB\_MODE\_HOST}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00299}00299                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00300}00300         \textcolor{keywordflow}{if} (uaa-\/>\mbox{\hyperlink{structusb__attach__arg_a66c2afc71fce73cc432f7d58593e1f26}{info}}.\mbox{\hyperlink{structusbd__lookup__info_ab0d02dc59a6a042d2de8c12708afc8b3}{bInterfaceClass}} != \mbox{\hyperlink{usb_8h_a77eca6d49a1f0f93fb31aad0ef2f33b4}{UICLASS\_HID}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00301}00301                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00302}00302 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00303}00303         \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__lookup_8c_aa691ad42d532498716f358cb1c994fb2}{usbd\_lookup\_id\_by\_uaa}}(\mbox{\hyperlink{cp2112_8c_a4b1d318edb805e5c790f81678770b524}{cp2112\_devs}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{cp2112_8c_a4b1d318edb805e5c790f81678770b524}{cp2112\_devs}}), uaa) == 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00304}00304                 \textcolor{keywordflow}{return} (BUS\_PROBE\_DEFAULT);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00305}00305         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00306}00306 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00307}00307 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00308}00308 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00309}\mbox{\hyperlink{cp2112_8c_a4c2cfa780a6fbe8069cb2024898f74ee}{00309}} \mbox{\hyperlink{cp2112_8c_a4c2cfa780a6fbe8069cb2024898f74ee}{cp2112\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00310}00310 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00311}00311         \textcolor{keyword}{struct }\mbox{\hyperlink{structversion__request}{version\_request}} vdata;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00312}00312         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__attach__arg}{usb\_attach\_arg}} *uaa;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00313}00313         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00314}00314         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00315}00315 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00316}00316         uaa = device\_get\_ivars(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00317}00317         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00319}00319         \mbox{\hyperlink{usb__util_8c_a2f65a197990caa1a69a16691ce4dc66a}{device\_set\_usb\_desc}}(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00320}00320 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00321}00321         sc-\/>\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{sc\_udev}} = uaa-\/>\mbox{\hyperlink{structusb__attach__arg_ac86557d3eaf77874d436ce38648b0276}{device}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00322}00322         sc-\/>\mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{sc\_iface\_index}} = uaa-\/>\mbox{\hyperlink{structusb__attach__arg_a66c2afc71fce73cc432f7d58593e1f26}{info}}.\mbox{\hyperlink{structusbd__lookup__info_a50a68740a4c82f1a9b999d4a7994b550}{bIfaceIndex}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00324}00324         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(dev, \mbox{\hyperlink{cp2112_8c_ad123e7cfb1d3420b46681e74ce8f2074}{CP2112\_REQ\_VERSION}}, \&vdata, \textcolor{keyword}{sizeof}(vdata));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00325}00325         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00326}00326                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00327}00327         device\_printf(dev, \textcolor{stringliteral}{"{}part number 0x\%02x, version 0x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00328}00328             vdata.\mbox{\hyperlink{structversion__request_aef571171be4c536a2eeaec0333e8553e}{part\_num}}, vdata.\mbox{\hyperlink{structversion__request_a6e99b2747c37d019a4150d1cb9eb92b3}{version}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00329}00329         \textcolor{keywordflow}{if} (vdata.\mbox{\hyperlink{structversion__request_aef571171be4c536a2eeaec0333e8553e}{part\_num}} != \mbox{\hyperlink{cp2112_8c_a7419d8aeec03a5304e9ba8f3e30a0c00}{CP2112\_PART\_NUM}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00330}00330                 device\_printf(dev, \textcolor{stringliteral}{"{}unsupported part number\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00331}00331                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00332}00332         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00333}00333         sc-\/>\mbox{\hyperlink{structcp2112__softc_a79bafd6db686b4f1e46c969fa2944b95}{sc\_version}} = vdata.\mbox{\hyperlink{structversion__request_a6e99b2747c37d019a4150d1cb9eb92b3}{version}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00334}00334         sc-\/>\mbox{\hyperlink{structcp2112__softc_aa428c67b8d83ce52e7620bfcf005b0ce}{sc\_gpio\_dev}} = device\_add\_child(dev, \textcolor{stringliteral}{"{}gpio"{}}, -\/1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00335}00335         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112__softc_aa428c67b8d83ce52e7620bfcf005b0ce}{sc\_gpio\_dev}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00336}00336                 err = device\_probe\_and\_attach(sc-\/>\mbox{\hyperlink{structcp2112__softc_aa428c67b8d83ce52e7620bfcf005b0ce}{sc\_gpio\_dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00337}00337                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00338}00338                         device\_printf(dev, \textcolor{stringliteral}{"{}failed to attach gpio child\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00339}00339                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00340}00340         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00341}00341                 device\_printf(dev, \textcolor{stringliteral}{"{}failed to create gpio child\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00342}00342         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00343}00343 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00344}00344         sc-\/>\mbox{\hyperlink{structcp2112__softc_ae1dcd00e4713f6b1b5231f673ffe398b}{sc\_iic\_dev}} = device\_add\_child(dev, \textcolor{stringliteral}{"{}iichb"{}}, -\/1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00345}00345         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112__softc_ae1dcd00e4713f6b1b5231f673ffe398b}{sc\_iic\_dev}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00346}00346                 err = device\_probe\_and\_attach(sc-\/>\mbox{\hyperlink{structcp2112__softc_ae1dcd00e4713f6b1b5231f673ffe398b}{sc\_iic\_dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00347}00347                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00348}00348                         device\_printf(dev, \textcolor{stringliteral}{"{}failed to attach iic child\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00349}00349                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00350}00350         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00351}00351                 device\_printf(dev, \textcolor{stringliteral}{"{}failed to create iic child\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00352}00352         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00353}00353 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00354}00354         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00355}00355 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00356}00356 detach:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00357}00357         \mbox{\hyperlink{cp2112_8c_a8d7ee9e941c9cbb64979b629377ed2a3}{cp2112\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00358}00358         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00359}00359 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00360}00360 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00361}00361 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00362}\mbox{\hyperlink{cp2112_8c_a8d7ee9e941c9cbb64979b629377ed2a3}{00362}} \mbox{\hyperlink{cp2112_8c_a8d7ee9e941c9cbb64979b629377ed2a3}{cp2112\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00363}00363 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00364}00364         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00365}00365 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00366}00366         err = bus\_generic\_detach(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00367}00367         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00368}00368                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00369}00369         device\_delete\_children(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00370}00370         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00371}00371 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00372}00372 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00373}00373 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00374}\mbox{\hyperlink{cp2112_8c_a5e17f07c6a185a46e8bf6527d3a2f8ff}{00374}} \mbox{\hyperlink{cp2112_8c_a5e17f07c6a185a46e8bf6527d3a2f8ff}{cp2112\_gpio\_read\_pin}}(device\_t dev, uint32\_t pin\_num, \textcolor{keywordtype}{bool} *on)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00375}00375 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00376}00376         \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__get__req}{gpio\_get\_req}} data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00377}00377         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00378}00378         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00379}00379 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00380}00380         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00381}00381         \mbox{\hyperlink{cp2112_8c_a0c4677f38dc122f687944e668a55426a}{CP2112GPIO\_LOCKED}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00382}00382 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00383}00383         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(device\_get\_parent(dev),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00384}00384             \mbox{\hyperlink{cp2112_8c_acfec7998153f115adeced0e416fe427f}{CP2112\_REQ\_GPIO\_GET}}, \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00385}00385         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00386}00386                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00387}00387         *on = (data.state \& ((uint8\_t)1 << pin\_num)) != 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00388}00388         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00389}00389 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00390}00390 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00391}00391 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00392}00392 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00393}\mbox{\hyperlink{cp2112_8c_a6d0b2124cb8c77df3c7ea639cd0a0c24}{00393}} \mbox{\hyperlink{cp2112_8c_a6d0b2124cb8c77df3c7ea639cd0a0c24}{cp2112\_gpio\_write\_pin}}(device\_t dev, uint32\_t pin\_num, \textcolor{keywordtype}{bool} on)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00394}00394 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00395}00395         \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__set__req}{gpio\_set\_req}} data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00396}00396         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00397}00397         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00398}00398         \textcolor{keywordtype}{bool} actual;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00399}00399 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00400}00400         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00401}00401         \mbox{\hyperlink{cp2112_8c_a0c4677f38dc122f687944e668a55426a}{CP2112GPIO\_LOCKED}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00402}00402 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00403}00403         data.state = (uint8\_t)on << pin\_num;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00404}00404         data.mask = (uint8\_t)1 << pin\_num;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00405}00405         err = \mbox{\hyperlink{cp2112_8c_a6e1333c75ff8cf84cafda710aeb1e37c}{cp2112\_set\_report}}(device\_get\_parent(dev),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00406}00406             \mbox{\hyperlink{cp2112_8c_ab7e3bc65d83eef196c0b72b49efb50c1}{CP2112\_REQ\_GPIO\_SET}}, \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00407}00407         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00408}00408                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00409}00409         err = \mbox{\hyperlink{cp2112_8c_a5e17f07c6a185a46e8bf6527d3a2f8ff}{cp2112\_gpio\_read\_pin}}(dev, pin\_num, \&actual);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00410}00410         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00411}00411                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00412}00412         \textcolor{keywordflow}{if} (actual != on)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00413}00413                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00414}00414         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00415}00415 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00416}00416 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00417}00417 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00418}\mbox{\hyperlink{cp2112_8c_a259d338b76a5a72659553a90f644c715}{00418}} \mbox{\hyperlink{cp2112_8c_a259d338b76a5a72659553a90f644c715}{cp2112\_gpio\_configure\_write\_pin}}(device\_t dev, uint32\_t pin\_num,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00419}00419     \textcolor{keywordtype}{bool} output, \textcolor{keyword}{enum} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0}{cp2112\_out\_mode}} *mode)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00420}00420 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00421}00421         \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__config__req}{gpio\_config\_req}} data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00422}00422         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00423}00423         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00424}00424         uint8\_t mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00426}00426         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00427}00427         \mbox{\hyperlink{cp2112_8c_a0c4677f38dc122f687944e668a55426a}{CP2112GPIO\_LOCKED}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00428}00428 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00429}00429         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(device\_get\_parent(dev),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00430}00430             \mbox{\hyperlink{cp2112_8c_aea3c91437c30c4079cc1a8c3fbbcb595}{CP2112\_REQ\_GPIO\_CFG}}, \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00431}00431         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00432}00432                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00433}00433 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00434}00434         mask = (uint8\_t)1 << pin\_num;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00435}00435         \textcolor{keywordflow}{if} (output) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00436}00436                 data.output |= mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00437}00437                 \textcolor{keywordflow}{switch} (*mode) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00438}00438                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{OUT\_PP}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00439}00439                         data.pushpull |= mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00440}00440                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00441}00441                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00442}00442                         data.pushpull \&= \string~mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00443}00443                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00444}00444                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00445}00445                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00446}00446                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00447}00447         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00448}00448                 data.output \&= \string~mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00449}00449         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00451}00451         err = \mbox{\hyperlink{cp2112_8c_a6e1333c75ff8cf84cafda710aeb1e37c}{cp2112\_set\_report}}(device\_get\_parent(dev),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00452}00452             \mbox{\hyperlink{cp2112_8c_aea3c91437c30c4079cc1a8c3fbbcb595}{CP2112\_REQ\_GPIO\_CFG}}, \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00453}00453         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00454}00454                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00455}00455 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00456}00456         \textcolor{comment}{/* Read back and verify. */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00457}00457         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(device\_get\_parent(dev),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00458}00458             \mbox{\hyperlink{cp2112_8c_aea3c91437c30c4079cc1a8c3fbbcb595}{CP2112\_REQ\_GPIO\_CFG}}, \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00459}00459         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00460}00460                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00462}00462         \textcolor{keywordflow}{if} (((data.output \& mask) != 0) != output)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00463}00463                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00464}00464         \textcolor{keywordflow}{if} (output) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00465}00465                 \textcolor{keywordflow}{switch} (*mode) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00466}00466                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{OUT\_PP}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00467}00467                         \textcolor{keywordflow}{if} ((data.pushpull \& mask) == 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00468}00468                                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00469}00469                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00470}00470                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00471}00471                         \textcolor{keywordflow}{if} ((data.pushpull \& mask) != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00472}00472                                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00473}00473                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00474}00474                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00475}00475                         *mode = (data.pushpull \& mask) != 0 ?}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00476}00476                             \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{OUT\_PP}} : \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00477}00477                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00478}00478                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00479}00479         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00480}00480         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00481}00481 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00482}00482 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00483}00483 \textcolor{keyword}{static} device\_t}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00484}\mbox{\hyperlink{cp2112_8c_a5319f12b934ec11f687f8833379fa3a4}{00484}} \mbox{\hyperlink{cp2112_8c_a5319f12b934ec11f687f8833379fa3a4}{cp2112\_gpio\_get\_bus}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00485}00485 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00486}00486         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00487}00487 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00488}00488         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00489}00489         \textcolor{keywordflow}{return} (sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{busdev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00490}00490 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00491}00491 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00492}00492 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00493}\mbox{\hyperlink{cp2112_8c_a8276f1b9f1a11888d6e31507914ec628}{00493}} \mbox{\hyperlink{cp2112_8c_a8276f1b9f1a11888d6e31507914ec628}{cp2112\_gpio\_pin\_max}}(device\_t dev, \textcolor{keywordtype}{int} *maxpin)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00494}00494 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00495}00495 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00496}00496         *maxpin = \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}} -\/ 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00497}00497         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00498}00498 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00499}00499 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00500}00500 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00501}\mbox{\hyperlink{cp2112_8c_a29866b69d6c5d44b02b922503ad67f34}{00501}} \mbox{\hyperlink{cp2112_8c_a29866b69d6c5d44b02b922503ad67f34}{cp2112\_gpio\_pin\_set}}(device\_t dev, uint32\_t pin\_num, uint32\_t pin\_value)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00502}00502 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00503}00503         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00504}00504         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00505}00505 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00506}00506         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00507}00507                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00508}00508 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00509}00509         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00510}00510         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00511}00511         err = \mbox{\hyperlink{cp2112_8c_a6d0b2124cb8c77df3c7ea639cd0a0c24}{cp2112\_gpio\_write\_pin}}(dev, pin\_num, pin\_value != 0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00512}00512         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00514}00514         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00515}00515 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00517}00517 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00518}\mbox{\hyperlink{cp2112_8c_a7bc71eca820536a2be6784ad499996c5}{00518}} \mbox{\hyperlink{cp2112_8c_a7bc71eca820536a2be6784ad499996c5}{cp2112\_gpio\_pin\_get}}(device\_t dev, uint32\_t pin\_num, uint32\_t *pin\_value)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00519}00519 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00520}00520         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00521}00521         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00522}00522         \textcolor{keywordtype}{bool} on;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00523}00523 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00524}00524         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00525}00525                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00526}00526 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00527}00527         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00528}00528         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00529}00529         err = \mbox{\hyperlink{cp2112_8c_a5e17f07c6a185a46e8bf6527d3a2f8ff}{cp2112\_gpio\_read\_pin}}(dev, pin\_num, \&on);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00530}00530         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00531}00531 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00532}00532         \textcolor{keywordflow}{if} (err == 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00533}00533                 *pin\_value = on;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00534}00534         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00535}00535 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00536}00536 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00537}00537 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00538}\mbox{\hyperlink{cp2112_8c_a67253a541dd21f56e76ea25524b1ddad}{00538}} \mbox{\hyperlink{cp2112_8c_a67253a541dd21f56e76ea25524b1ddad}{cp2112\_gpio\_pin\_toggle}}(device\_t dev, uint32\_t pin\_num)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00539}00539 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00540}00540         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00541}00541         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00542}00542         \textcolor{keywordtype}{bool} on;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00543}00543 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00544}00544         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00545}00545                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00546}00546 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00547}00547         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00548}00548         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00549}00549         err = \mbox{\hyperlink{cp2112_8c_a5e17f07c6a185a46e8bf6527d3a2f8ff}{cp2112\_gpio\_read\_pin}}(dev, pin\_num, \&on);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00550}00550         \textcolor{keywordflow}{if} (err == 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00551}00551                 err = \mbox{\hyperlink{cp2112_8c_a6d0b2124cb8c77df3c7ea639cd0a0c24}{cp2112\_gpio\_write\_pin}}(dev, pin\_num, !on);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00552}00552         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00553}00553 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00554}00554         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00555}00555 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00556}00556 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00557}00557 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00558}\mbox{\hyperlink{cp2112_8c_a2376e77efae68487e465e8ae6a571195}{00558}} \mbox{\hyperlink{cp2112_8c_a2376e77efae68487e465e8ae6a571195}{cp2112\_gpio\_pin\_getcaps}}(device\_t dev, uint32\_t pin\_num, uint32\_t *caps)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00559}00559 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00560}00560         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00561}00561 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00562}00562         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00563}00563                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00564}00564 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00565}00565         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00566}00566         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00567}00567         *caps = sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a009864b0349da13fab18f8c2de32ad6f}{gpio\_caps}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00568}00568         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00569}00569 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00570}00570         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00571}00571 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00572}00572 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00573}00573 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00574}\mbox{\hyperlink{cp2112_8c_af56c849cf6cb437e818a342a6e513023}{00574}} \mbox{\hyperlink{cp2112_8c_af56c849cf6cb437e818a342a6e513023}{cp2112\_gpio\_pin\_getflags}}(device\_t dev, uint32\_t pin\_num, uint32\_t *flags)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00575}00575 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00576}00576         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00577}00577 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00578}00578         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00579}00579                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00580}00580 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00581}00581         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00582}00582         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00583}00583         *flags = sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{pins}}[pin\_num].gp\_flags;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00584}00584         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00585}00585 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00586}00586         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00587}00587 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00588}00588 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00589}00589 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00590}\mbox{\hyperlink{cp2112_8c_a2296eac12271145ead37589e497fd8b5}{00590}} \mbox{\hyperlink{cp2112_8c_a2296eac12271145ead37589e497fd8b5}{cp2112\_gpio\_pin\_getname}}(device\_t dev, uint32\_t pin\_num, \textcolor{keywordtype}{char} *name)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00591}00591 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00592}00592         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00593}00593 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00594}00594         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00595}00595                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00596}00596 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00597}00597         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00598}00598         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00599}00599         memcpy(name, sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{pins}}[pin\_num].gp\_name, GPIOMAXNAME);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00600}00600         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00601}00601 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00602}00602         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00603}00603 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00604}00604 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00605}00605 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00606}\mbox{\hyperlink{cp2112_8c_afb44e59a061989893e4a1df36ed6cd67}{00606}} \mbox{\hyperlink{cp2112_8c_afb44e59a061989893e4a1df36ed6cd67}{cp2112\_gpio\_pin\_setflags}}(device\_t dev, uint32\_t pin\_num, uint32\_t flags)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00607}00607 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00608}00608         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00609}00609         \textcolor{keyword}{struct }gpio\_pin *pin;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00610}00610         \textcolor{keyword}{enum} \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0}{cp2112\_out\_mode}} out\_mode;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00611}00611         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00612}00612 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00613}00613         \textcolor{keywordflow}{if} (pin\_num >= \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00614}00614                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00615}00615 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00616}00616         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00617}00617         \textcolor{keywordflow}{if} ((flags \& sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a009864b0349da13fab18f8c2de32ad6f}{gpio\_caps}}) != flags)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00618}00618                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00619}00619 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00620}00620         \textcolor{keywordflow}{if} ((flags \& (GPIO\_PIN\_INPUT | GPIO\_PIN\_OUTPUT)) == 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00621}00621                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00622}00622         \textcolor{keywordflow}{if} ((flags \& (GPIO\_PIN\_INPUT | GPIO\_PIN\_OUTPUT)) ==}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00623}00623                 (GPIO\_PIN\_INPUT | GPIO\_PIN\_OUTPUT)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00624}00624                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00625}00625         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00626}00626         \textcolor{keywordflow}{if} ((flags \& GPIO\_PIN\_INPUT) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00627}00627                 \textcolor{keywordflow}{if} ((flags \& (GPIO\_PIN\_OPENDRAIN | GPIO\_PIN\_PUSHPULL)) != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00628}00628                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00629}00629         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00630}00630                 \textcolor{keywordflow}{if} ((flags \& (GPIO\_PIN\_OPENDRAIN | GPIO\_PIN\_PUSHPULL)) ==}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00631}00631                     (GPIO\_PIN\_OPENDRAIN | GPIO\_PIN\_PUSHPULL))}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00632}00632                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00633}00633         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00634}00634 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00635}00635         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00636}00636 \textcolor{comment}{         * If neither push-\/pull or open-\/drain is explicitly requested, then}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00637}00637 \textcolor{comment}{         * preserve the current state.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00638}00638 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00639}00639         out\_mode = \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0ae047f0e12d77dfaa46dcd66c151b2330}{OUT\_KEEP}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00640}00640         \textcolor{keywordflow}{if} ((flags \& GPIO\_PIN\_OUTPUT) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00641}00641                 \textcolor{keywordflow}{if} ((flags \& GPIO\_PIN\_OPENDRAIN) != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00642}00642                         out\_mode = \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00643}00643                 \textcolor{keywordflow}{if} ((flags \& GPIO\_PIN\_PUSHPULL) != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00644}00644                         out\_mode = \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0a6499141f57f0cba644b6b2e97302df36}{OUT\_PP}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00645}00645         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00646}00646 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00647}00647         \mbox{\hyperlink{cp2112_8c_a8a1b3037935fc7683b014ed0a1f8e9ef}{CP2112GPIO\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00648}00648         pin = \&sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{pins}}[pin\_num];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00649}00649         err = \mbox{\hyperlink{cp2112_8c_a259d338b76a5a72659553a90f644c715}{cp2112\_gpio\_configure\_write\_pin}}(dev, pin\_num,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00650}00650             (flags \& GPIO\_PIN\_OUTPUT) != 0, \&out\_mode);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00651}00651         \textcolor{keywordflow}{if} (err == 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00652}00652                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00653}00653 \textcolor{comment}{                 * If neither open-\/drain or push-\/pull was requested, then see}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00654}00654 \textcolor{comment}{                 * what hardware actually had.  Otherwise, it has been}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00655}00655 \textcolor{comment}{                 * reconfigured as requested.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00656}00656 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00657}00657                 \textcolor{keywordflow}{if} ((flags \& GPIO\_PIN\_OUTPUT) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00658}00658                     (flags \& (GPIO\_PIN\_OPENDRAIN | GPIO\_PIN\_PUSHPULL)) == 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00659}00659                         KASSERT(out\_mode != \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0ae047f0e12d77dfaa46dcd66c151b2330}{OUT\_KEEP}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00660}00660                             (\textcolor{stringliteral}{"{}impossible current output mode"{}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00661}00661                         \textcolor{keywordflow}{if} (out\_mode == \mbox{\hyperlink{cp2112_8c_a0411006683a87cc02326ed4258cff6d0afa8c4c4232156660e25ed59e5f10cb94}{OUT\_OD}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00662}00662                                 flags |= GPIO\_PIN\_OPENDRAIN;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00663}00663                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00664}00664                                 flags |= GPIO\_PIN\_PUSHPULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00665}00665                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00666}00666                 pin-\/>gp\_flags = flags;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00667}00667         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00668}00668         \mbox{\hyperlink{cp2112_8c_a27bf1a2656771c7a1d6e714541d79e9b}{CP2112GPIO\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00669}00669 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00670}00670         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00671}00671 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00672}00672 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00673}00673 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00674}\mbox{\hyperlink{cp2112_8c_a404635f329dc2eb6012fc5b68633810c}{00674}} \mbox{\hyperlink{cp2112_8c_a404635f329dc2eb6012fc5b68633810c}{cp2112gpio\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00675}00675 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00676}00676         device\_set\_desc(dev, \textcolor{stringliteral}{"{}CP2112 GPIO interface"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00677}00677         \textcolor{keywordflow}{return} (BUS\_PROBE\_SPECIFIC);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00678}00678 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00679}00679 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00680}00680 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00681}\mbox{\hyperlink{cp2112_8c_a9beff6eda031676836080200aa5185b5}{00681}} \mbox{\hyperlink{cp2112_8c_a9beff6eda031676836080200aa5185b5}{cp2112gpio\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00682}00682 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00683}00683         \textcolor{keyword}{struct }\mbox{\hyperlink{structgpio__config__req}{gpio\_config\_req}} data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00684}00684         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00685}00685         device\_t cp2112;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00686}00686         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00687}00687         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00688}00688         uint8\_t mask;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00689}00689 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00690}00690         cp2112 = device\_get\_parent(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00691}00691         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00692}00692         sx\_init(\&sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_aa1ea8eb8bc08e5e0d931f17478be07e0}{gpio\_lock}}, \textcolor{stringliteral}{"{}cp2112 lock"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00693}00693 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00694}00694         sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a009864b0349da13fab18f8c2de32ad6f}{gpio\_caps}} = GPIO\_PIN\_INPUT | GPIO\_PIN\_OUTPUT | GPIO\_PIN\_OPENDRAIN |}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00695}00695             GPIO\_PIN\_PUSHPULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00696}00696 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00697}00697         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(cp2112, \mbox{\hyperlink{cp2112_8c_aea3c91437c30c4079cc1a8c3fbbcb595}{CP2112\_REQ\_GPIO\_CFG}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00698}00698             \&data, \textcolor{keyword}{sizeof}(data));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00699}00699         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00700}00700                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00701}00701 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00702}00702         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{cp2112_8c_a089507f4c1c5fb78d3cef9a3e1289242}{CP2112\_GPIO\_COUNT}}; i++) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00703}00703                 \textcolor{keyword}{struct }gpio\_pin *pin;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00704}00704 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00705}00705                 mask = (uint8\_t)1 << i;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00706}00706                 pin = \&sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a72d6e8fb7d990bd30a82b46fcb5cefb7}{pins}}[i];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00707}00707                 pin-\/>gp\_flags = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00708}00708 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00709}00709                 snprintf(pin-\/>gp\_name, GPIOMAXNAME, \textcolor{stringliteral}{"{}GPIO\%u"{}}, i);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00710}00710                 pin-\/>gp\_name[GPIOMAXNAME -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00711}00711 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00712}00712                 \textcolor{keywordflow}{if} ((i == 0 \&\& (data.special \& \mbox{\hyperlink{cp2112_8c_a1cd9a1ed609492f3f5404139fdae809e}{CP2112\_GPIO\_SPEC\_TX0}}) != 0) ||}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00713}00713                     (i == 1 \&\& (data.special \& \mbox{\hyperlink{cp2112_8c_ae36537514addce4395f22bbbb5562ca6}{CP2112\_GPIO\_SPEC\_RX1}}) != 0) ||}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00714}00714                     (i == 7 \&\& (data.special \& \mbox{\hyperlink{cp2112_8c_ad32117c1f3e873292a0670853f1eceb3}{CP2112\_GPIO\_SPEC\_CLK7}}) != 0)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00715}00715                         \textcolor{comment}{/* Special mode means that a pin is not for GPIO. */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00716}00716                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((data.output \& mask) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00717}00717                         pin-\/>gp\_flags |= GPIO\_PIN\_OUTPUT;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00718}00718                         \textcolor{keywordflow}{if} ((data.pushpull \& mask) != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00719}00719                                 pin-\/>gp\_flags |= GPIO\_PIN\_PUSHPULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00720}00720                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00721}00721                                 pin-\/>gp\_flags |= GPIO\_PIN\_OPENDRAIN;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00722}00722                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00723}00723                         pin-\/>gp\_flags |= GPIO\_PIN\_INPUT;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00724}00724                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00725}00725         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00726}00726 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00727}00727         sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{busdev}} = gpiobus\_attach\_bus(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00728}00728         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{busdev}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00729}00729                 device\_printf(dev, \textcolor{stringliteral}{"{}gpiobus\_attach\_bus failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00730}00730                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00731}00731         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00732}00732         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00733}00733 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00734}00734 detach:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00735}00735         \mbox{\hyperlink{cp2112_8c_a4aacf543706ef16a5823afb7a18367bc}{cp2112gpio\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00736}00736         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00737}00737 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00738}00738 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00739}00739 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00740}\mbox{\hyperlink{cp2112_8c_a4aacf543706ef16a5823afb7a18367bc}{00740}} \mbox{\hyperlink{cp2112_8c_a4aacf543706ef16a5823afb7a18367bc}{cp2112gpio\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00741}00741 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00742}00742         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00743}00743 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00744}00744         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00745}00745         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_a1f59ad12cf3cc7d3f656dae4d651e65b}{busdev}} != NULL)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00746}00746                 gpiobus\_detach\_bus(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00747}00747         sx\_destroy(\&sc-\/>\mbox{\hyperlink{structcp2112gpio__softc_aa1ea8eb8bc08e5e0d931f17478be07e0}{gpio\_lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00748}00748         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00749}00749 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00750}00750 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00751}00751 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00752}\mbox{\hyperlink{cp2112_8c_a6d4fd33afd01a54afc1037e0a9ac86d0}{00752}} \mbox{\hyperlink{cp2112_8c_a6d4fd33afd01a54afc1037e0a9ac86d0}{cp2112iic\_intr\_write\_callback}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00753}00753 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00754}00754         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00755}00755         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *psc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00756}00756         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__page__cache}{usb\_page\_cache}} *pc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00757}00757 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00758}00758         sc = \mbox{\hyperlink{usb__transfer_8c_ab75ef6d82c4a000a3d16c133d1d589b0}{usbd\_xfer\_softc}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00759}00759         psc = device\_get\_softc(device\_get\_parent(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00760}00760 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00761}00761         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00762}00762 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00763}00763         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00764}00764         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a3aa7120c3ecab31972b8fe219530f552}{USB\_ST\_SETUP}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00765}00765                 pc = \mbox{\hyperlink{usb__transfer_8c_a6e66695b916f0770a259bed959c21555}{usbd\_xfer\_get\_frame}}(xfer, 0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00766}00766                 \mbox{\hyperlink{usb__busdma_8c_accb7cd85c3477e50c1ba1b1489226d09}{usbd\_copy\_in}}(pc, 0, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}}, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00767}00767                 \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 0, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00768}00768                 \mbox{\hyperlink{usb__transfer_8c_a10f82b008c3a5311e5210e44beaca014}{usbd\_xfer\_set\_frames}}(xfer, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00769}00769                 \mbox{\hyperlink{usb__transfer_8c_a10c440b0b97cac293b4df9d558f15bac}{usbd\_transfer\_submit}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00770}00770                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00771}00771         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a8f0386217ba77be3e47721fae9aa9b3d}{USB\_ST\_TRANSFERRED}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00772}00772                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00773}00773                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00774}00774                 cv\_signal(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00775}00775                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00776}00776         \textcolor{keywordflow}{default}:                        \textcolor{comment}{/* Error */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00777}00777                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}write intr state \%d error \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00778}00778                     \mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer), \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00779}00779                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00780}00780                 cv\_signal(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00781}00781                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945abe72c3e4b6644141519a28f1ef97f717}{USB\_ERR\_CANCELLED}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00782}00782                         \textcolor{comment}{/* try to clear stall first */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00783}00783                         \mbox{\hyperlink{usb__transfer_8c_abadf9cb2f8e81a5133af0c8030039de3}{usbd\_xfer\_set\_stall}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00784}00784                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00785}00785                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00786}00786         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00787}00787 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00788}00788 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00789}00789 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00790}\mbox{\hyperlink{cp2112_8c_a26d6190fee8c8d4402c1f29c45e0ea76}{00790}} \mbox{\hyperlink{cp2112_8c_a26d6190fee8c8d4402c1f29c45e0ea76}{cp2112iic\_intr\_read\_callback}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00791}00791 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00792}00792         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc = \mbox{\hyperlink{usb__transfer_8c_ab75ef6d82c4a000a3d16c133d1d589b0}{usbd\_xfer\_softc}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00793}00793         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__page__cache}{usb\_page\_cache}} *pc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00794}00794         \textcolor{keywordtype}{int} act\_len, \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00795}00795 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00796}00796         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00797}00797         \mbox{\hyperlink{usb__transfer_8c_ac0c68320222f26c2a3eba47b46c47899}{usbd\_xfer\_status}}(xfer, \&act\_len, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00798}00798 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00799}00799         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00800}00800         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a8f0386217ba77be3e47721fae9aa9b3d}{USB\_ST\_TRANSFERRED}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00801}00801                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00802}00802                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00803}00803                             \textcolor{stringliteral}{"{}interrupt while previous is pending, ignored\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00804}00804                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} == 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00805}00805                         uint8\_t buf[8];}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00806}00806 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00807}00807                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00808}00808 \textcolor{comment}{                         * There is a spurious Transfer Status Response and}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00809}00809 \textcolor{comment}{                         * zero-\/length Read Response during hardware}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00810}00810 \textcolor{comment}{                         * configuration.  Possibly they carry some information}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00811}00811 \textcolor{comment}{                         * about the initial bus state.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00812}00812 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00813}00813                         \textcolor{keywordflow}{if} (device\_is\_attached(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}})) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00814}00814                                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00815}00815                                     \textcolor{stringliteral}{"{}unsolicited interrupt, ignored\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00816}00816                                 \textcolor{keywordflow}{if} (bootverbose) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00817}00817                                         pc = \mbox{\hyperlink{usb__transfer_8c_a6e66695b916f0770a259bed959c21555}{usbd\_xfer\_get\_frame}}(xfer, 0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00818}00818                                         \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} = MIN(\textcolor{keyword}{sizeof}(buf), act\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00819}00819                                         \mbox{\hyperlink{usb__busdma_8c_af52eece45b7868dbf58386f4c9e4eb9a}{usbd\_copy\_out}}(pc, 0, buf, \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00820}00820                                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}data: \%*D\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00821}00821                                             \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}}, buf, \textcolor{stringliteral}{"{} "{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00822}00822                                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00823}00823                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00824}00824                                 pc = \mbox{\hyperlink{usb__transfer_8c_a6e66695b916f0770a259bed959c21555}{usbd\_xfer\_get\_frame}}(xfer, 0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00825}00825                                 \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} = MIN(\textcolor{keyword}{sizeof}(buf), act\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00826}00826                                 \mbox{\hyperlink{usb__busdma_8c_af52eece45b7868dbf58386f4c9e4eb9a}{usbd\_copy\_out}}(pc, 0, buf, \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00827}00827                                 \textcolor{keywordflow}{if} (buf[0] == \mbox{\hyperlink{cp2112_8c_aea687eefe424d6a990d69c4650b027f0}{CP2112\_REQ\_SMB\_XFER\_STATUS\_RESP}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00828}00828                                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00829}00829                                             \textcolor{stringliteral}{"{}initial bus status0 = 0x\%02x, "{}}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00830}00830                                             \textcolor{stringliteral}{"{}status1 = 0x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00831}00831                                             buf[1], buf[2]);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00832}00832                                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00833}00833                         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00834}00834                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (act\_len == \mbox{\hyperlink{cp2112_8c_ad1d8ef9bded33674abc3ced1ae147f0f}{CP2112\_REPORT\_SIZE}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00835}00835                         pc = \mbox{\hyperlink{usb__transfer_8c_a6e66695b916f0770a259bed959c21555}{usbd\_xfer\_get\_frame}}(xfer, 0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00836}00836                         \mbox{\hyperlink{usb__busdma_8c_af52eece45b7868dbf58386f4c9e4eb9a}{usbd\_copy\_out}}(pc, 0, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}}, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00837}00837                         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00838}00838                         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00839}00839                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00840}00840                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00841}00841                             \textcolor{stringliteral}{"{}unexpected input report length \%u\(\backslash\)n"{}}, act\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00842}00842                         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00843}00843                         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00844}00844                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00845}00845                 cv\_signal(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00846}00846         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a3aa7120c3ecab31972b8fe219530f552}{USB\_ST\_SETUP}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00847}00847 tr\_setup:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00848}00848                 \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 0, \mbox{\hyperlink{usb__transfer_8c_ae34a7cc2f01c6dfb68bca6fd0b72647e}{usbd\_xfer\_max\_len}}(xfer));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00849}00849                 \mbox{\hyperlink{usb__transfer_8c_a10c440b0b97cac293b4df9d558f15bac}{usbd\_transfer\_submit}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00850}00850                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00851}00851 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00852}00852         \textcolor{keywordflow}{default}:                        \textcolor{comment}{/* Error */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00853}00853                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}read intr state \%d error \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00854}00854                     \mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer), \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00855}00855 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00856}00856                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00857}00857                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00858}00858                 cv\_signal(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00859}00859                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945abe72c3e4b6644141519a28f1ef97f717}{USB\_ERR\_CANCELLED}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00860}00860                         \textcolor{comment}{/* try to clear stall first */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00861}00861                         \mbox{\hyperlink{usb__transfer_8c_abadf9cb2f8e81a5133af0c8030039de3}{usbd\_xfer\_set\_stall}}(xfer);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00862}00862                         \textcolor{keywordflow}{goto} tr\_setup;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00863}00863                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00864}00864                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00865}00865         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00866}00866 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00867}00867 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00868}\mbox{\hyperlink{cp2112_8c_a9751438a90c1d6a8554a46d66b9defbd}{00868}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__config}{usb\_config}} \mbox{\hyperlink{cp2112_8c_a9751438a90c1d6a8554a46d66b9defbd}{cp2112iic\_config}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960a5f0ca3b238b86fd4ae1ca1cfc3ebb3fd}{CP2112\_N\_TRANSFER}}] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00869}00869         [\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960aeee5d47940c01d494c6203fdf8faceb3}{CP2112\_INTR\_OUT}}] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00870}00870                 .\mbox{\hyperlink{structusb__config_a5bd5d569870291a54d9bed8377ed8b10}{type}} = \mbox{\hyperlink{usb_8h_a01e28e87ad16f6dfffefc6ccab08baed}{UE\_INTERRUPT}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00871}00871                 .endpoint = \mbox{\hyperlink{usb_8h_a1e8d1f402536e634471569b83f603197}{UE\_ADDR\_ANY}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00872}00872                 .direction = \mbox{\hyperlink{usb_8h_a9a98e1bc9388db2ab5213e9d6496e851}{UE\_DIR\_OUT}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00873}00873                 .flags = \{ .pipe\_bof = 1, .no\_pipe\_ok = 1, \},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00874}00874                 .bufsize = 0,   \textcolor{comment}{/* use wMaxPacketSize */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00875}00875                 .callback = \&\mbox{\hyperlink{cp2112_8c_a6d4fd33afd01a54afc1037e0a9ac86d0}{cp2112iic\_intr\_write\_callback}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00876}00876         \},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00877}00877         [\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960ab0e5946c830725cdfb66451d703f0aad}{CP2112\_INTR\_IN}}] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00878}00878                 .type = \mbox{\hyperlink{usb_8h_a01e28e87ad16f6dfffefc6ccab08baed}{UE\_INTERRUPT}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00879}00879                 .endpoint = \mbox{\hyperlink{usb_8h_a1e8d1f402536e634471569b83f603197}{UE\_ADDR\_ANY}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00880}00880                 .direction = \mbox{\hyperlink{usb_8h_a72bb077a860132c175c166f344c75893}{UE\_DIR\_IN}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00881}00881                 .flags = \{ .pipe\_bof = 1, .short\_xfer\_ok = 1, \},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00882}00882                 .bufsize = 0,   \textcolor{comment}{/* use wMaxPacketSize */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00883}00883                 .callback = \&\mbox{\hyperlink{cp2112_8c_a26d6190fee8c8d4402c1f29c45e0ea76}{cp2112iic\_intr\_read\_callback}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00884}00884         \},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00885}00885 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00886}00886 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00887}00887 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00888}\mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{00888}} \mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{cp2112iic\_send\_req}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *data,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00889}00889     uint16\_t \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00890}00890 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00891}00891         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00892}00892 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00893}00893         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00894}00894         KASSERT(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} == 0, (\textcolor{stringliteral}{"{}\%s: conflicting request"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00895}00895 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00896}00896         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}} = data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00897}00897         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} = \mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00898}00898 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00899}00899         DTRACE\_PROBE1(send\_\_req, uint8\_t, *(\textcolor{keyword}{const} uint8\_t *)data);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00900}00900 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00901}00901         \mbox{\hyperlink{usb__transfer_8c_a7a1f2d22a70b832e8cc31366adec443d}{usbd\_transfer\_start}}(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960aeee5d47940c01d494c6203fdf8faceb3}{CP2112\_INTR\_OUT}}]);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00902}00902 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00903}00903         \textcolor{keywordflow}{while} (!sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00904}00904                 cv\_wait(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}}, \&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00905}00905 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00906}00906         \mbox{\hyperlink{usb__transfer_8c_abe245d973df0cfd6fb96b884d33ebce3}{usbd\_transfer\_stop}}(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960aeee5d47940c01d494c6203fdf8faceb3}{CP2112\_INTR\_OUT}}]);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00907}00907 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00908}00908         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00909}00909         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}} = NULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00910}00910         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00911}00911         err = sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_ad57336bd3140458145732648b6706566}{out}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00912}00912         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00913}00913                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}output report 0x\%02x failed: \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00914}00914                     *(\textcolor{keyword}{const} uint8\_t*)data, err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00915}00915         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00916}00916         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00917}00917 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00918}00918 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00919}00919 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00920}\mbox{\hyperlink{cp2112_8c_aad855824c4f2a7461ac7b8ba1a1aa96a}{00920}} \mbox{\hyperlink{cp2112_8c_aad855824c4f2a7461ac7b8ba1a1aa96a}{cp2112iic\_req\_resp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *req\_data,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00921}00921     uint16\_t req\_len, \textcolor{keywordtype}{void} *resp\_data, uint16\_t resp\_len)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00922}00922 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00923}00923         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00925}00925         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00926}00926 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00927}00927         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00928}00928 \textcolor{comment}{         * Prepare to receive a response interrupt even before the}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00929}00929 \textcolor{comment}{         * request transfer is confirmed (USB\_ST\_TRANSFERED).}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00930}00930 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00931}00931         KASSERT(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} == 0, (\textcolor{stringliteral}{"{}\%s: conflicting request"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00932}00932         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} = resp\_len;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00933}00933         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}} = resp\_data;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00934}00934 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00935}00935         err = \mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{cp2112iic\_send\_req}}(sc, req\_data, req\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00936}00936         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00937}00937                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00938}00938                 sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}} = NULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00939}00939                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00940}00940         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00941}00941 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00942}00942         \textcolor{keywordflow}{while} (!sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00943}00943                 cv\_wait(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}}, \&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00944}00944 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00945}00945         err = sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00946}00946         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a1ad2c1af489b9f784e614206f6014a4e}{done}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00947}00947         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_a76287f5719accf9db9609fbbd81a535d}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00948}00948         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_aedda1d7a32647c488f072ba5d45ba149}{len}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00949}00949         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a57121436fad96e44f1cf6ed975cb4f0d}{in}}.\mbox{\hyperlink{structcp2112iic__softc_ad9fba91f632fe05f8360df12b7fa53e2}{data}} = NULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00950}00950         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00951}00951 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00952}00952 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00953}00953 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00954}\mbox{\hyperlink{cp2112_8c_a0b4412936f5fce855424432882d94f2e}{00954}} \mbox{\hyperlink{cp2112_8c_a0b4412936f5fce855424432882d94f2e}{cp2112iic\_check\_req\_status}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00955}00955 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00956}00956         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__xfer__status__req}{i2c\_xfer\_status\_req}} xfer\_status\_req;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00957}00957         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__xfer__status__resp}{i2c\_xfer\_status\_resp}} xfer\_status\_resp;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00958}00958         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00959}00959 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00960}00960         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00961}00961 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00962}00962         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00963}00963                 xfer\_status\_req.\mbox{\hyperlink{structi2c__xfer__status__req_a2411bab86e7b14355c4c57a460373e74}{id}} = \mbox{\hyperlink{cp2112_8c_aadceaa19140c954a0679e3cc9eddafc7}{CP2112\_REQ\_SMB\_XFER\_STATUS\_REQ}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00964}00964                 xfer\_status\_req.\mbox{\hyperlink{structi2c__xfer__status__req_af9cb9262f09988ccc4cd09db3bcee41d}{request}} = 1;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00965}00965                 err = \mbox{\hyperlink{cp2112_8c_aad855824c4f2a7461ac7b8ba1a1aa96a}{cp2112iic\_req\_resp}}(sc,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00966}00966                     \&xfer\_status\_req, \textcolor{keyword}{sizeof}(xfer\_status\_req),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00967}00967                     \&xfer\_status\_resp, \textcolor{keyword}{sizeof}(xfer\_status\_resp));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00968}00968 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00969}00969                 \textcolor{keywordflow}{if} (xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a73da01b3ec254ba27d2897a503c8eaa2}{id}} != \mbox{\hyperlink{cp2112_8c_aea687eefe424d6a990d69c4650b027f0}{CP2112\_REQ\_SMB\_XFER\_STATUS\_RESP}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00970}00970                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00971}00971                             \textcolor{stringliteral}{"{}unexpected response 0x\%02x to status request\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00972}00972                             xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a73da01b3ec254ba27d2897a503c8eaa2}{id}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00973}00973                         err = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00974}00974                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00975}00975                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00976}00976 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00977}00977                 DTRACE\_PROBE4(xfer\_\_status, uint8\_t, xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a2df5b84ebf8fd93a363ba55d45e28173}{status0}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00978}00978                     uint8\_t, xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a8ce3a6327e9d79a753b6dd4bb11817a2}{status1}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00979}00979                     uint16\_t, be16toh(xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a951aab5feaefa9094f62841c1f0cf5ed}{status2}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00980}00980                     uint16\_t, be16toh(xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_ac44e297be56fc2058f9af301a19699ac}{status3}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00981}00981 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00982}00982                 \textcolor{keywordflow}{switch} (xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a2df5b84ebf8fd93a363ba55d45e28173}{status0}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00983}00983                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_aebc2dbaa2ccb5e02d8e3198c87a39416}{CP2112\_IIC\_STATUS0\_IDLE}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00984}00984                         err = IIC\_ESTATUS;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00985}00985                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00986}00986                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a5ae19c726ff1af11f4cb155f0a0e7dab}{CP2112\_IIC\_STATUS0\_BUSY}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00987}00987                         err = ERESTART; \textcolor{comment}{/* non-\/I2C, special handling */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00988}00988                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00989}00989                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_aa285367f21ade6d11c525e34dc50a49e}{CP2112\_IIC\_STATUS0\_CMP}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00990}00990                         err = IIC\_NOERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00991}00991                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00992}00992                 \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a99336d9f1a715ce8b45d89a1cdfe3446}{CP2112\_IIC\_STATUS0\_ERROR}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00993}00993                         \textcolor{keywordflow}{switch} (xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a8ce3a6327e9d79a753b6dd4bb11817a2}{status1}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00994}00994                         \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_afdec84e67b0442ba2c0ee553f5a4f83f}{CP2112\_IIC\_STATUS1\_TIMEOUT\_NACK}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00995}00995                                 err = IIC\_ENOACK;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00996}00996                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00997}00997                         \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_ac97bd415d65dd5e519c304717addd9be}{CP2112\_IIC\_STATUS1\_TIMEOUT\_BUS}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00998}00998                                 err = IIC\_ETIMEOUT;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l00999}00999                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01000}01000                         \textcolor{keywordflow}{case} \mbox{\hyperlink{cp2112_8c_a0ab4546053a0dc49b73bedc90ace6594}{CP2112\_IIC\_STATUS1\_ARB\_LOST}}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01001}01001                                 err = IIC\_EBUSBSY;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01002}01002                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01003}01003                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01004}01004                                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01005}01005                                     \textcolor{stringliteral}{"{}i2c error, status = 0x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01006}01006                                     xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a8ce3a6327e9d79a753b6dd4bb11817a2}{status1}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01007}01007                                 err = IIC\_ESTATUS;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01008}01008                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01009}01009                         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01010}01010                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01011}01011                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01012}01012                         device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01013}01013                             \textcolor{stringliteral}{"{}unknown i2c xfer status0 0x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01014}01014                             xfer\_status\_resp.\mbox{\hyperlink{structi2c__xfer__status__resp_a2df5b84ebf8fd93a363ba55d45e28173}{status0}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01015}01015                         err = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01016}01016                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01017}01017                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01018}01018 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01019}01019         \} \textcolor{keywordflow}{while} (err == ERESTART);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01020}01020 out:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01021}01021         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01022}01022 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01023}01023 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01024}01024 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01025}\mbox{\hyperlink{cp2112_8c_ab51462379e26b3353ac5f06ef299a0f3}{01025}} \mbox{\hyperlink{cp2112_8c_ab51462379e26b3353ac5f06ef299a0f3}{cp2112iic\_read\_data}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc, \textcolor{keywordtype}{void} *data, uint16\_t in\_len,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01026}01026     uint16\_t *out\_len)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01027}01027 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01028}01028         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__data__read__force__send__req}{i2c\_data\_read\_force\_send\_req}} data\_read\_force\_send;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01029}01029         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__data__read__resp}{i2c\_data\_read\_resp}} data\_read\_resp;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01030}01030         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01031}01031 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01032}01032         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01033}01033 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01034}01034         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01035}01035 \textcolor{comment}{         * Prepare to receive a response interrupt even before the request}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01036}01036 \textcolor{comment}{         * transfer is confirmed (USB\_ST\_TRANSFERED).}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01037}01037 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01038}01038 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01039}01039         \textcolor{keywordflow}{if} (in\_len > \textcolor{keyword}{sizeof}(data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{data}}))}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01040}01040                 in\_len = \textcolor{keyword}{sizeof}(data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{data}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01041}01041         data\_read\_force\_send.\mbox{\hyperlink{structi2c__data__read__force__send__req_aa2e6ce229ee23709be9d73122445009c}{id}} = \mbox{\hyperlink{cp2112_8c_a08e8e6ba84e1ac69e7adcfb595c98531}{CP2112\_REQ\_SMB\_READ\_FORCE\_SEND}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01042}01042         data\_read\_force\_send.\mbox{\hyperlink{structi2c__data__read__force__send__req_ae4ceba06c96f1014f348246b9656eeff}{len}} = htobe16(in\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01043}01043         err = \mbox{\hyperlink{cp2112_8c_aad855824c4f2a7461ac7b8ba1a1aa96a}{cp2112iic\_req\_resp}}(sc,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01044}01044             \&data\_read\_force\_send, \textcolor{keyword}{sizeof}(data\_read\_force\_send),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01045}01045             \&data\_read\_resp, \textcolor{keyword}{sizeof}(data\_read\_resp));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01046}01046         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01047}01047                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01048}01048 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01049}01049         \textcolor{keywordflow}{if} (data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_afca97bbc7754877125a7fb23e3edf89f}{id}} != \mbox{\hyperlink{cp2112_8c_a814f2ae1dfabb7becd917ae33b976cf5}{CP2112\_REQ\_SMB\_READ\_RESPONSE}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01050}01050                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01051}01051                     \textcolor{stringliteral}{"{}unexpected response 0x\%02x to data read request\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01052}01052                     data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_afca97bbc7754877125a7fb23e3edf89f}{id}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01053}01053                 err = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01054}01054                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01055}01055         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01056}01056 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01057}01057         DTRACE\_PROBE2(read\_\_response, uint8\_t, data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a9eb6978e81a1cd12bea358fc8d5c0347}{status}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01058}01058             uint8\_t, data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a4cd56f72fe44e4049b65cd00063a4ee8}{len}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01059}01059 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01060}01060         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01061}01061 \textcolor{comment}{         * We expect either the request completed status or, more typical for}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01062}01062 \textcolor{comment}{         * this driver, the bus idle status because of the preceding}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01063}01063 \textcolor{comment}{         * Force Read Status command (which is not an I2C request).}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01064}01064 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01065}01065         \textcolor{keywordflow}{if} (data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a9eb6978e81a1cd12bea358fc8d5c0347}{status}} != \mbox{\hyperlink{cp2112_8c_aa285367f21ade6d11c525e34dc50a49e}{CP2112\_IIC\_STATUS0\_CMP}} \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01066}01066             data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a9eb6978e81a1cd12bea358fc8d5c0347}{status}} != \mbox{\hyperlink{cp2112_8c_aebc2dbaa2ccb5e02d8e3198c87a39416}{CP2112\_IIC\_STATUS0\_IDLE}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01067}01067                 err = IIC\_EBUSERR;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01068}01068                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01069}01069         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01070}01070         \textcolor{keywordflow}{if} (data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a4cd56f72fe44e4049b65cd00063a4ee8}{len}} > in\_len) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01071}01071                 device\_printf(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}device returns more data than asked\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01072}01072                 err = IIC\_EOVERFLOW;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01073}01073                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01074}01074         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01075}01075 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01076}01076         *out\_len = data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a4cd56f72fe44e4049b65cd00063a4ee8}{len}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01077}01077         \textcolor{keywordflow}{if} (*out\_len > 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01078}01078                 memcpy(\mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{data}}, data\_read\_resp.\mbox{\hyperlink{structi2c__data__read__resp_a0991c68242f34ceeed91403442014320}{data}}, *out\_len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01079}01079 out:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01080}01080         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01081}01081 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01082}01082 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01083}01083 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01084}\mbox{\hyperlink{cp2112_8c_af2f4c2bb391cdf388633ea2a982e65a1}{01084}} \mbox{\hyperlink{cp2112_8c_af2f4c2bb391cdf388633ea2a982e65a1}{cp2112iic\_transfer}}(device\_t dev, \textcolor{keyword}{struct} iic\_msg *msgs, uint32\_t nmsgs)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01085}01085 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01086}01086         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc = device\_get\_softc(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01087}01087         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *psc = device\_get\_softc(device\_get\_parent(dev));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01088}01088         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *reason = NULL;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01089}01089         uint32\_t i;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01090}01090         uint16\_t read\_off, to\_read;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01091}01091         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01092}01092 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01093}01093         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01094}01094 \textcolor{comment}{         * The hardware interface imposes limits on allowed I2C messages.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01095}01095 \textcolor{comment}{         * It is not possible to explicitly send a start or stop.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01096}01096 \textcolor{comment}{         * It is not possible to do a zero length transfer.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01097}01097 \textcolor{comment}{         * For this reason it's impossible to send a message with no data}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01098}01098 \textcolor{comment}{         * at all (like an SMBus quick message).}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01099}01099 \textcolor{comment}{         * Each read or write transfer beginning with the start condition}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01100}01100 \textcolor{comment}{         * and ends with the stop condition.  The only exception is that}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01101}01101 \textcolor{comment}{         * it is possible to have a write transfer followed by a read}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01102}01102 \textcolor{comment}{         * transfer to the same slave with the repeated start condition}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01103}01103 \textcolor{comment}{         * between them.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01104}01104 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01105}01105         \textcolor{keywordflow}{for} (i = 0; i < nmsgs; i++) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01106}01106                 \textcolor{keywordflow}{if} (i == 0 \&\& (msgs[i].flags \& IIC\_M\_NOSTART) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01107}01107                         reason = \textcolor{stringliteral}{"{}first message without start"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01108}01108                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01109}01109                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01110}01110                 \textcolor{keywordflow}{if} (i == nmsgs -\/ 1 \&\& (msgs[i].flags \& IIC\_M\_NOSTOP) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01111}01111                         reason = \textcolor{stringliteral}{"{}last message without stop"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01112}01112                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01113}01113                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01114}01114                 \textcolor{keywordflow}{if} (msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} == 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01115}01115                         reason = \textcolor{stringliteral}{"{}message with no data"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01116}01116                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01117}01117                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01118}01118                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_RD) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01119}01119                     msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} > \mbox{\hyperlink{cp2112_8c_a8dd60de7021c6f4585468ce873daac1e}{CP2112\_IIC\_MAX\_READ\_LEN}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01120}01120                         reason = \textcolor{stringliteral}{"{}too long read"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01121}01121                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01122}01122                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01123}01123                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_RD) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01124}01124                     msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} > \mbox{\hyperlink{cp2112_8c_a9620a0a04f93688ff7cecbf9fdb050ec}{SIZEOF\_FIELD}}(\mbox{\hyperlink{structi2c__write__req}{i2c\_write\_req}}, data)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01125}01125                         reason = \textcolor{stringliteral}{"{}too long write"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01126}01126                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01127}01127                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01128}01128                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_NOSTART) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01129}01129                         reason = \textcolor{stringliteral}{"{}message without start or repeated start"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01130}01130                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01131}01131                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01132}01132                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_NOSTOP) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01133}01133                     (msgs[i].flags \& IIC\_M\_RD) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01134}01134                         reason = \textcolor{stringliteral}{"{}read without stop"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01135}01135                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01136}01136                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01137}01137                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_NOSTOP) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01138}01138                     psc-\/>\mbox{\hyperlink{structcp2112__softc_a79bafd6db686b4f1e46c969fa2944b95}{sc\_version}} < \mbox{\hyperlink{cp2112_8c_abc69ffca62dac7e7213a5f84a8de1d0c}{CP2112\_IIC\_REPSTART\_VER}}) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01139}01139                         reason = \textcolor{stringliteral}{"{}write without stop"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01140}01140                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01141}01141                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01142}01142                 \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_NOSTOP) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01143}01143                     msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} > \mbox{\hyperlink{cp2112_8c_a9620a0a04f93688ff7cecbf9fdb050ec}{SIZEOF\_FIELD}}(\mbox{\hyperlink{structi2c__write__read__req}{i2c\_write\_read\_req}}, wdata)) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01144}01144                         reason = \textcolor{stringliteral}{"{}too long write without stop"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01145}01145                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01146}01146                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01147}01147                 \textcolor{keywordflow}{if} (i > 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01148}01148                         \textcolor{keywordflow}{if} ((msgs[i -\/ 1].flags \& IIC\_M\_NOSTOP) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01149}01149                             msgs[i].slave != msgs[i -\/ 1].slave) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01150}01150                                 reason = \textcolor{stringliteral}{"{}change of slave without stop"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01151}01151                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01152}01152                         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01153}01153                         \textcolor{keywordflow}{if} ((msgs[i -\/ 1].flags \& IIC\_M\_NOSTOP) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01154}01154                             (msgs[i].flags \& IIC\_M\_RD) == 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01155}01155                                 reason = \textcolor{stringliteral}{"{}write after repeated start"{}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01156}01156                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01157}01157                         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01158}01158                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01159}01159         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01160}01160         \textcolor{keywordflow}{if} (reason != NULL) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01161}01161                 \textcolor{keywordflow}{if} (bootverbose)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01162}01162                         device\_printf(dev, \textcolor{stringliteral}{"{}unsupported i2c message: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01163}01163                             reason);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01164}01164                 \textcolor{keywordflow}{return} (IIC\_ENOTSUPP);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01165}01165         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01166}01166 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01167}01167         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01168}01168 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01169}01169         \textcolor{keywordflow}{for} (i = 0; i < nmsgs; i++) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01170}01170                 \textcolor{keywordflow}{if} (i + 1 < nmsgs \&\& (msgs[i].flags \& IIC\_M\_NOSTOP) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01171}01171                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01172}01172 \textcolor{comment}{                         * Combine <write><repeated start><read> into a single}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01173}01173 \textcolor{comment}{                         * CP2112 operation.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01174}01174 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01175}01175                         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__write__read__req}{i2c\_write\_read\_req}} \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01176}01176 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01177}01177                         KASSERT((msgs[i].flags \& IIC\_M\_RD) == 0,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01178}01178                             (\textcolor{stringliteral}{"{}read without stop"{}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01179}01179                         KASSERT((msgs[i + 1].flags \& IIC\_M\_RD) != 0,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01180}01180                             (\textcolor{stringliteral}{"{}write after write without stop"{}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01181}01181                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.id = \mbox{\hyperlink{cp2112_8c_aac18fb1aaa5922dd3137040c81a16760}{CP2112\_REQ\_SMB\_WRITE\_READ}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01182}01182                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.slave = msgs[i].slave \& \string~LSB;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01183}01183                         to\_read = msgs[i + 1].len;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01184}01184                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.rlen = htobe16(to\_read);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01185}01185                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wlen = msgs[i].len;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01186}01186                         memcpy(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wdata, msgs[i].buf, msgs[i].len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01187}01187                         err = \mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{cp2112iic\_send\_req}}(sc, \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} + 5);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01188}01188 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01189}01189                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01190}01190 \textcolor{comment}{                         * The next message is already handled.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01191}01191 \textcolor{comment}{                         * Also needed for read data to go into the right msg.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01192}01192 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01193}01193                         i++;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01194}01194                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((msgs[i].flags \& IIC\_M\_RD) != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01195}01195                         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__read__req}{i2c\_read\_req}} \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01196}01196 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01197}01197                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.id = \mbox{\hyperlink{cp2112_8c_ab20d89c310af6f6e4024892a21c14da6}{CP2112\_REQ\_SMB\_READ}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01198}01198                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.slave = msgs[i].slave \& \string~LSB;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01199}01199                         to\_read = msgs[i].len;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01200}01200                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.len = htobe16(to\_read);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01201}01201                         err = \mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{cp2112iic\_send\_req}}(sc, \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01202}01202                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01203}01203                         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__write__req}{i2c\_write\_req}} \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01204}01204 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01205}01205                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.id = \mbox{\hyperlink{cp2112_8c_a4633c18b15a478f4498c218538eea66b}{CP2112\_REQ\_SMB\_WRITE}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01206}01206                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.slave = msgs[i].slave \& \string~LSB;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01207}01207                         \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.len = msgs[i].len;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01208}01208                         memcpy(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.data, msgs[i].buf, msgs[i].len);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01209}01209                         to\_read = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01210}01210                         err = \mbox{\hyperlink{cp2112_8c_a590521e90f5d5c70942bbc49d208b977}{cp2112iic\_send\_req}}(sc, \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, msgs[i].\mbox{\hyperlink{ehci_8h_a8aed22e2c7b283705ec82e0120515618}{len}} + 3);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01211}01211                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01212}01212                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01213}01213                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01214}01214 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01215}01215                 err = \mbox{\hyperlink{cp2112_8c_a0b4412936f5fce855424432882d94f2e}{cp2112iic\_check\_req\_status}}(sc);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01216}01216                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01217}01217                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01218}01218 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01219}01219                 read\_off = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01220}01220                 \textcolor{keywordflow}{while} (to\_read > 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01221}01221                         uint16\_t act\_read;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01222}01222 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01223}01223                         err = \mbox{\hyperlink{cp2112_8c_ab51462379e26b3353ac5f06ef299a0f3}{cp2112iic\_read\_data}}(sc, msgs[i].buf + read\_off,}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01224}01224                             to\_read, \&act\_read);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01225}01225                         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01226}01226                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01227}01227                         KASSERT(act\_read <= to\_read, (\textcolor{stringliteral}{"{}cp2112iic\_read\_data "{}}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01228}01228                             \textcolor{stringliteral}{"{}returned more data than asked"{}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01229}01229                         read\_off += act\_read;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01230}01230                         to\_read -\/= act\_read;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01231}01231                 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01232}01232                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01233}01233                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01234}01234         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01235}01235 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01236}01236         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01237}01237         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01238}01238 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01239}01239 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01240}01240 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01241}\mbox{\hyperlink{cp2112_8c_a692ab02f73f0658561cd08c1bba97ca5}{01241}} \mbox{\hyperlink{cp2112_8c_a692ab02f73f0658561cd08c1bba97ca5}{cp2112iic\_reset}}(device\_t dev, u\_char speed, u\_char addr, u\_char *oldaddr)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01242}01242 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01243}01243         \textcolor{keyword}{struct }\mbox{\hyperlink{structi2c__cfg__req}{i2c\_cfg\_req}} i2c\_cfg;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01244}01244         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01245}01245         device\_t cp2112;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01246}01246         u\_int busfreq;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01247}01247         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01248}01248 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01249}01249         sc = device\_get\_softc(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01250}01250         cp2112 = device\_get\_parent(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01251}01251         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{iicbus\_dev}} == NULL)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01252}01252                 busfreq = 100000;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01253}01253         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01254}01254                 busfreq = IICBUS\_GET\_FREQUENCY(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{iicbus\_dev}}, speed);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01255}01255 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01256}01256         err = \mbox{\hyperlink{cp2112_8c_afe05313fcd4f0ba4bc901c50ded76786}{cp2112\_get\_report}}(cp2112, \mbox{\hyperlink{cp2112_8c_a1c78467d71e5b56ab9c83c2834c17971}{CP2112\_REQ\_SMB\_CFG}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01257}01257             \&i2c\_cfg, \textcolor{keyword}{sizeof}(i2c\_cfg));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01258}01258         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01259}01259                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}failed to get CP2112\_REQ\_SMB\_CFG report\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01260}01260                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01261}01261         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01262}01262 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01263}01263         \textcolor{keywordflow}{if} (oldaddr != NULL)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01264}01264                 *oldaddr = i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_aef7758e747c00b5a4f4ababd65a47f19}{slave\_addr}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01265}01265         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01266}01266 \textcolor{comment}{         * For simplicity we do not enable Auto Send Read}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01267}01267 \textcolor{comment}{         * because of erratum CP2112\_E101 (fixed in version 3).}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01268}01268 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01269}01269 \textcolor{comment}{         * TODO: set I2C parameters based on configuration preferences:}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01270}01270 \textcolor{comment}{         * -\/ read and write timeouts (no timeout by default),}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01271}01271 \textcolor{comment}{         * -\/ SCL low timeout (disabled by default),}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01272}01272 \textcolor{comment}{         * etc.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01273}01273 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01274}01274 \textcolor{comment}{         * TODO: should the device reset request (0x01) be sent?}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01275}01275 \textcolor{comment}{         * If the device disconnects as a result, then no.}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01276}01276 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01277}01277         i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_ae619f54cb21051410e8d27859b885b0c}{speed}} = htobe32(busfreq);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01278}01278         \textcolor{keywordflow}{if} (addr != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01279}01279                 i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_aef7758e747c00b5a4f4ababd65a47f19}{slave\_addr}} = addr;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01280}01280         i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_aa9df786cbc9fdb87382ecbf07147266e}{auto\_send\_read}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01281}01281         i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a8682f8dee30b81bfaa1d8e51ce554ff5}{retry\_count}} = htobe16(1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01282}01282         i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a26470088f4dea9f55c7b83a6b04dae0a}{scl\_low\_timeout}} = 0;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01283}01283         \textcolor{keywordflow}{if} (bootverbose) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01284}01284                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}speed \%d Hz\(\backslash\)n"{}}, be32toh(i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_ae619f54cb21051410e8d27859b885b0c}{speed}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01285}01285                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}slave addr 0x\%02x\(\backslash\)n"{}}, i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_aef7758e747c00b5a4f4ababd65a47f19}{slave\_addr}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01286}01286                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}auto send read \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01287}01287                     i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_aa9df786cbc9fdb87382ecbf07147266e}{auto\_send\_read}} ? \textcolor{stringliteral}{"{}on"{}} : \textcolor{stringliteral}{"{}off"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01288}01288                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}write timeout \%d ms (0 -\/ disabled)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01289}01289                     be16toh(i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a1ebe28ed7fa2ccd18d74d1e8a3cfb0ea}{write\_timeout}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01290}01290                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}read timeout \%d ms (0 -\/ disabled)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01291}01291                     be16toh(i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a589601b9abe86d915fdbb5e6b7cb8fb7}{read\_timeout}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01292}01292                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}scl low timeout \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01293}01293                     i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a26470088f4dea9f55c7b83a6b04dae0a}{scl\_low\_timeout}} ? \textcolor{stringliteral}{"{}on"{}} : \textcolor{stringliteral}{"{}off"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01294}01294                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}retry count \%d (0 -\/ no limit)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01295}01295                     be16toh(i2c\_cfg.\mbox{\hyperlink{structi2c__cfg__req_a8682f8dee30b81bfaa1d8e51ce554ff5}{retry\_count}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01296}01296         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01297}01297         err = \mbox{\hyperlink{cp2112_8c_a6e1333c75ff8cf84cafda710aeb1e37c}{cp2112\_set\_report}}(cp2112, \mbox{\hyperlink{cp2112_8c_a1c78467d71e5b56ab9c83c2834c17971}{CP2112\_REQ\_SMB\_CFG}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01298}01298             \&i2c\_cfg, \textcolor{keyword}{sizeof}(i2c\_cfg));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01299}01299         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01300}01300                 device\_printf(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}failed to set CP2112\_REQ\_SMB\_CFG report\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01301}01301                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01302}01302         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01303}01303         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01304}01304 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01305}01305 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01306}01306 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01307}\mbox{\hyperlink{cp2112_8c_ab2190e2b43d06805d96f8fac3090572c}{01307}} \mbox{\hyperlink{cp2112_8c_ab2190e2b43d06805d96f8fac3090572c}{cp2112iic\_probe}}(device\_t \mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01308}01308 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01309}01309         device\_set\_desc(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}}, \textcolor{stringliteral}{"{}CP2112 I2C interface"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01310}01310         \textcolor{keywordflow}{return} (BUS\_PROBE\_SPECIFIC);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01311}01311 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01312}01312 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01313}01313 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01314}\mbox{\hyperlink{cp2112_8c_a201aa8f49af74ef61808eec6c487f1fd}{01314}} \mbox{\hyperlink{cp2112_8c_a201aa8f49af74ef61808eec6c487f1fd}{cp2112iic\_attach}}(device\_t \mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01315}01315 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01316}01316         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01317}01317         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}} *psc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01318}01318         device\_t cp2112;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01319}01319         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01320}01320 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01321}01321         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01322}01322         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}} = dev;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01323}01323         cp2112 = device\_get\_parent(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01324}01324         psc = device\_get\_softc(cp2112);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01325}01325 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01326}01326         mtx\_init(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}}, \textcolor{stringliteral}{"{}cp2112iic lock"{}}, NULL, MTX\_DEF | MTX\_RECURSE);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01327}01327         cv\_init(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}}, \textcolor{stringliteral}{"{}cp2112iic cv"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01328}01328 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01329}01329         err = \mbox{\hyperlink{usb__transfer_8c_a7494c04fae5c5e7ef1af436308670a21}{usbd\_transfer\_setup}}(psc-\/>\mbox{\hyperlink{structcp2112__softc_a8d9f55878b67c03ca3fd8bf66e9575f0}{sc\_udev}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01330}01330             \&psc-\/>\mbox{\hyperlink{structcp2112__softc_a83b9814f23de666707b88255a8c3181b}{sc\_iface\_index}}, sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}, \mbox{\hyperlink{cp2112_8c_a9751438a90c1d6a8554a46d66b9defbd}{cp2112iic\_config}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01331}01331             nitems(\mbox{\hyperlink{cp2112_8c_a9751438a90c1d6a8554a46d66b9defbd}{cp2112iic\_config}}), sc, \&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01332}01332         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01333}01333                 device\_printf(dev, \textcolor{stringliteral}{"{}usbd\_transfer\_setup failed \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01334}01334                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01335}01335         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01336}01336 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01337}01337         \textcolor{comment}{/* Prepare to receive interrupts. */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01338}01338         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01339}01339         \mbox{\hyperlink{usb__transfer_8c_a7a1f2d22a70b832e8cc31366adec443d}{usbd\_transfer\_start}}(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960ab0e5946c830725cdfb66451d703f0aad}{CP2112\_INTR\_IN}}]);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01340}01340         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01341}01341 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01342}01342         sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{iicbus\_dev}} = device\_add\_child(dev, \textcolor{stringliteral}{"{}iicbus"{}}, -\/1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01343}01343         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structcp2112iic__softc_aebfaa982b444c21ec3effbf0783f8be8}{iicbus\_dev}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01344}01344                 device\_printf(dev, \textcolor{stringliteral}{"{}iicbus creation failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01345}01345                 err = ENXIO;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01346}01346                 \textcolor{keywordflow}{goto} detach;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01347}01347         \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01348}01348         bus\_generic\_attach(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01349}01349         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01350}01350 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01351}01351 detach:}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01352}01352         \mbox{\hyperlink{cp2112_8c_ab8d54b635aec2e2eecd69f310b7259e3}{cp2112iic\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01353}01353         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01354}01354 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01355}01355 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01356}01356 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01357}\mbox{\hyperlink{cp2112_8c_ab8d54b635aec2e2eecd69f310b7259e3}{01357}} \mbox{\hyperlink{cp2112_8c_ab8d54b635aec2e2eecd69f310b7259e3}{cp2112iic\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01358}01358 \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01359}01359         \textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01360}01360         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01361}01361 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01362}01362         sc = device\_get\_softc(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01363}01363         err = bus\_generic\_detach(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01364}01364         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01365}01365                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01366}01366         device\_delete\_children(\mbox{\hyperlink{structcp2112iic__softc_aec290e1d129eb41de139128ab34d8ce8}{dev}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01367}01367 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01368}01368         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01369}01369         \mbox{\hyperlink{usb__transfer_8c_abe245d973df0cfd6fb96b884d33ebce3}{usbd\_transfer\_stop}}(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}[\mbox{\hyperlink{cp2112_8c_af9bdc3014f3d54c426b6d2df10de4960ab0e5946c830725cdfb66451d703f0aad}{CP2112\_INTR\_IN}}]);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01370}01370         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01371}01371         \mbox{\hyperlink{usb__transfer_8c_a2f5ab55bfe7f356bb7a7505ff35c9741}{usbd\_transfer\_unsetup}}(sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a37a5abe39b6010011c3b4a787f9e201a}{xfers}}, nitems(\mbox{\hyperlink{cp2112_8c_a9751438a90c1d6a8554a46d66b9defbd}{cp2112iic\_config}}));}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01372}01372 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01373}01373         cv\_destroy(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a66fee12addc107747f27f6261560a6b6}{cv}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01374}01374         mtx\_destroy(\&sc-\/>\mbox{\hyperlink{structcp2112iic__softc_a4e6f378fb90169128d50724e06e21dbc}{io}}.\mbox{\hyperlink{structcp2112iic__softc_a5299f4f6c404f03aa0ad2234be429822}{lock}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01375}01375 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01376}01376         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01377}01377 \}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01378}01378 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01379}\mbox{\hyperlink{cp2112_8c_a0655093e8a8c0923f0e70558d28f7dba}{01379}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{cp2112_8c_a0655093e8a8c0923f0e70558d28f7dba}{cp2112hid\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01380}01380         DEVMETHOD(device\_probe,         \mbox{\hyperlink{cp2112_8c_a8fca9d3fa35e4dfa0baac6ad08317bcf}{cp2112\_probe}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01381}01381         DEVMETHOD(device\_attach,        \mbox{\hyperlink{cp2112_8c_a4c2cfa780a6fbe8069cb2024898f74ee}{cp2112\_attach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01382}01382         DEVMETHOD(device\_detach,        \mbox{\hyperlink{cp2112_8c_a8d7ee9e941c9cbb64979b629377ed2a3}{cp2112\_detach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01383}01383 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01384}01384         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01385}01385 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01386}01386 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01387}\mbox{\hyperlink{cp2112_8c_a22f24b1966088f2df934893e1f9ddc6f}{01387}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{cp2112_8c_a22f24b1966088f2df934893e1f9ddc6f}{cp2112hid\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01388}01388         .name = \textcolor{stringliteral}{"{}cp2112hid"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01389}01389         .methods = \mbox{\hyperlink{cp2112_8c_a0655093e8a8c0923f0e70558d28f7dba}{cp2112hid\_methods}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01390}01390         .size = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112__softc}{cp2112\_softc}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01391}01391 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01392}01392 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01393}\mbox{\hyperlink{cp2112_8c_a91aa9a6c007af818d33f097ff3bfde37}{01393}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{cp2112_8c_a91aa9a6c007af818d33f097ff3bfde37}{cp2112hid\_devclass}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01394}\mbox{\hyperlink{cp2112_8c_a519df56bcdadba592a48010542567f27}{01394}} \mbox{\hyperlink{cp2112_8c_a519df56bcdadba592a48010542567f27}{DRIVER\_MODULE}}(cp2112hid, uhub, \mbox{\hyperlink{cp2112_8c_a22f24b1966088f2df934893e1f9ddc6f}{cp2112hid\_driver}}, \mbox{\hyperlink{cp2112_8c_a91aa9a6c007af818d33f097ff3bfde37}{cp2112hid\_devclass}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01395}01395     NULL, NULL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01396}\mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{01396}} \mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{MODULE\_DEPEND}}(cp2112hid, \mbox{\hyperlink{usb__if_8m_adfa3f6da9c4881e494b180c4ebb06470}{usb}}, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01397}\mbox{\hyperlink{cp2112_8c_a87ed27d5621c7e8b52a857681b988039}{01397}} \mbox{\hyperlink{cp2112_8c_a87ed27d5621c7e8b52a857681b988039}{MODULE\_VERSION}}(cp2112hid, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01398}\mbox{\hyperlink{cp2112_8c_a0ada8b6c8755d9d8d890572600d6d10e}{01398}} \mbox{\hyperlink{cp2112_8c_a0ada8b6c8755d9d8d890572600d6d10e}{USB\_PNP\_HOST\_INFO}}(\mbox{\hyperlink{cp2112_8c_a4b1d318edb805e5c790f81678770b524}{cp2112\_devs}});}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01399}01399 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01400}\mbox{\hyperlink{cp2112_8c_ab6ad5ae586e0ddf4801d9c4da5cf5b3b}{01400}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{cp2112_8c_ab6ad5ae586e0ddf4801d9c4da5cf5b3b}{cp2112gpio\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01401}01401         \textcolor{comment}{/* Device */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01402}01402         DEVMETHOD(device\_probe,         \mbox{\hyperlink{cp2112_8c_a404635f329dc2eb6012fc5b68633810c}{cp2112gpio\_probe}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01403}01403         DEVMETHOD(device\_attach,        \mbox{\hyperlink{cp2112_8c_a9beff6eda031676836080200aa5185b5}{cp2112gpio\_attach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01404}01404         DEVMETHOD(device\_detach,        \mbox{\hyperlink{cp2112_8c_a4aacf543706ef16a5823afb7a18367bc}{cp2112gpio\_detach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01405}01405 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01406}01406         \textcolor{comment}{/* GPIO */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01407}01407         DEVMETHOD(gpio\_get\_bus,         \mbox{\hyperlink{cp2112_8c_a5319f12b934ec11f687f8833379fa3a4}{cp2112\_gpio\_get\_bus}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01408}01408         DEVMETHOD(gpio\_pin\_max,         \mbox{\hyperlink{cp2112_8c_a8276f1b9f1a11888d6e31507914ec628}{cp2112\_gpio\_pin\_max}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01409}01409         DEVMETHOD(gpio\_pin\_get,         \mbox{\hyperlink{cp2112_8c_a7bc71eca820536a2be6784ad499996c5}{cp2112\_gpio\_pin\_get}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01410}01410         DEVMETHOD(gpio\_pin\_set,         \mbox{\hyperlink{cp2112_8c_a29866b69d6c5d44b02b922503ad67f34}{cp2112\_gpio\_pin\_set}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01411}01411         DEVMETHOD(gpio\_pin\_toggle,      \mbox{\hyperlink{cp2112_8c_a67253a541dd21f56e76ea25524b1ddad}{cp2112\_gpio\_pin\_toggle}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01412}01412         DEVMETHOD(gpio\_pin\_getname,     \mbox{\hyperlink{cp2112_8c_a2296eac12271145ead37589e497fd8b5}{cp2112\_gpio\_pin\_getname}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01413}01413         DEVMETHOD(gpio\_pin\_getcaps,     \mbox{\hyperlink{cp2112_8c_a2376e77efae68487e465e8ae6a571195}{cp2112\_gpio\_pin\_getcaps}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01414}01414         DEVMETHOD(gpio\_pin\_getflags,    \mbox{\hyperlink{cp2112_8c_af56c849cf6cb437e818a342a6e513023}{cp2112\_gpio\_pin\_getflags}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01415}01415         DEVMETHOD(gpio\_pin\_setflags,    \mbox{\hyperlink{cp2112_8c_afb44e59a061989893e4a1df36ed6cd67}{cp2112\_gpio\_pin\_setflags}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01416}01416 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01417}01417         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01418}01418 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01419}01419 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01420}\mbox{\hyperlink{cp2112_8c_aadc56b7b3073223e47d63bef35032a14}{01420}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{cp2112_8c_aadc56b7b3073223e47d63bef35032a14}{cp2112gpio\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01421}01421         .name = \textcolor{stringliteral}{"{}gpio"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01422}01422         .methods = \mbox{\hyperlink{cp2112_8c_ab6ad5ae586e0ddf4801d9c4da5cf5b3b}{cp2112gpio\_methods}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01423}01423         .size = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112gpio__softc}{cp2112gpio\_softc}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01424}01424 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01425}01425 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01426}\mbox{\hyperlink{cp2112_8c_a88e682cc17bfcbf69cf1a8c10b6f6eaf}{01426}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{cp2112_8c_a88e682cc17bfcbf69cf1a8c10b6f6eaf}{cp2112gpio\_devclass}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01427}\mbox{\hyperlink{cp2112_8c_a16a27fdd8e6077fdbc64b5fc5bde5d81}{01427}} \mbox{\hyperlink{cp2112_8c_a519df56bcdadba592a48010542567f27}{DRIVER\_MODULE}}(cp2112gpio, cp2112hid, \mbox{\hyperlink{cp2112_8c_aadc56b7b3073223e47d63bef35032a14}{cp2112gpio\_driver}}, \mbox{\hyperlink{cp2112_8c_a88e682cc17bfcbf69cf1a8c10b6f6eaf}{cp2112gpio\_devclass}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01428}01428     NULL, NULL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01429}\mbox{\hyperlink{cp2112_8c_a9913f267c089c80ef5d67f9f562cd0d9}{01429}} \mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{MODULE\_DEPEND}}(cp2112gpio, cp2112hid, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01430}\mbox{\hyperlink{cp2112_8c_adb1c862c9df434983bba88d7e7e511ec}{01430}} \mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{MODULE\_DEPEND}}(cp2112gpio, gpiobus, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01431}\mbox{\hyperlink{cp2112_8c_a303a1a7ea045da02c3b9888716d54972}{01431}} \mbox{\hyperlink{cp2112_8c_a87ed27d5621c7e8b52a857681b988039}{MODULE\_VERSION}}(cp2112gpio, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01432}01432 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01433}\mbox{\hyperlink{cp2112_8c_a8c8da77a536851c6439e02963e5df506}{01433}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{cp2112_8c_a8c8da77a536851c6439e02963e5df506}{cp2112iic\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01434}01434         \textcolor{comment}{/* Device interface */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01435}01435         DEVMETHOD(device\_probe, \mbox{\hyperlink{cp2112_8c_ab2190e2b43d06805d96f8fac3090572c}{cp2112iic\_probe}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01436}01436         DEVMETHOD(device\_attach, \mbox{\hyperlink{cp2112_8c_a201aa8f49af74ef61808eec6c487f1fd}{cp2112iic\_attach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01437}01437         DEVMETHOD(device\_detach, \mbox{\hyperlink{cp2112_8c_ab8d54b635aec2e2eecd69f310b7259e3}{cp2112iic\_detach}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01438}01438 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01439}01439         \textcolor{comment}{/* I2C methods */}}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01440}01440         DEVMETHOD(iicbus\_transfer, \mbox{\hyperlink{cp2112_8c_af2f4c2bb391cdf388633ea2a982e65a1}{cp2112iic\_transfer}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01441}01441         DEVMETHOD(iicbus\_reset, \mbox{\hyperlink{cp2112_8c_a692ab02f73f0658561cd08c1bba97ca5}{cp2112iic\_reset}}),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01442}01442         DEVMETHOD(iicbus\_callback, iicbus\_null\_callback),}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01443}01443 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01444}01444         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01445}01445 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01446}01446 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01447}\mbox{\hyperlink{cp2112_8c_a3bdb484b280fc05d666e30fa61444507}{01447}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{cp2112_8c_a3bdb484b280fc05d666e30fa61444507}{cp2112iic\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01448}01448         \textcolor{stringliteral}{"{}iichb"{}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01449}01449         \mbox{\hyperlink{cp2112_8c_a8c8da77a536851c6439e02963e5df506}{cp2112iic\_methods}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01450}01450         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structcp2112iic__softc}{cp2112iic\_softc}})}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01451}01451 \};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01452}01452 }
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01453}\mbox{\hyperlink{cp2112_8c_a8b201ec6e0b02bce014298712a3c9a43}{01453}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{cp2112_8c_a8b201ec6e0b02bce014298712a3c9a43}{cp2112iic\_devclass}};}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01454}\mbox{\hyperlink{cp2112_8c_a2571c7d4e0802282b3ca03874f0f0557}{01454}} \mbox{\hyperlink{cp2112_8c_a519df56bcdadba592a48010542567f27}{DRIVER\_MODULE}}(cp2112iic, cp2112hid, \mbox{\hyperlink{cp2112_8c_a3bdb484b280fc05d666e30fa61444507}{cp2112iic\_driver}}, \mbox{\hyperlink{cp2112_8c_a8b201ec6e0b02bce014298712a3c9a43}{cp2112iic\_devclass}},}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01455}01455     NULL, NULL);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01456}\mbox{\hyperlink{cp2112_8c_ab3c05baceca6800ab56318bf59d4de3a}{01456}} \mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{MODULE\_DEPEND}}(cp2112iic, cp2112hid, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01457}\mbox{\hyperlink{cp2112_8c_a00360bfce6d3be8b71d173ba82f66cc2}{01457}} \mbox{\hyperlink{cp2112_8c_a4e51d4196fbceba9bc164db484947019}{MODULE\_DEPEND}}(cp2112iic, iicbus, IICBUS\_MINVER, IICBUS\_PREFVER, IICBUS\_MAXVER);}
\DoxyCodeLine{\Hypertarget{cp2112_8c_source_l01458}\mbox{\hyperlink{cp2112_8c_aeb9c5735811032b6bb6247ef6bdeec4d}{01458}} \mbox{\hyperlink{cp2112_8c_a87ed27d5621c7e8b52a857681b988039}{MODULE\_VERSION}}(cp2112iic, 1);}

\end{DoxyCode}
