\hypertarget{r12au__rx_8c_source}{}\doxysection{r12au\+\_\+rx.\+c}
\label{r12au__rx_8c_source}\index{dev/rtwn/rtl8812a/usb/r12au\_rx.c@{dev/rtwn/rtl8812a/usb/r12au\_rx.c}}
\mbox{\hyperlink{r12au__rx_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00003}00003 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00005}00005 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00006}00006 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00007}00007 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00008}00008 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00009}00009 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00010}00010 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00012}00012 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00013}00013 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00014}00014 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00015}00015 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00016}00016 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00017}00017 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00018}00018 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00019}00019 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00020}00020 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00021}00021 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00022}00022 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00023}00023 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00024}00024 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00025}00025 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00027}00027 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00028}\mbox{\hyperlink{r12au__rx_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00028}} \mbox{\hyperlink{r12au__rx_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00030}00030 \textcolor{preprocessor}{\#include "{}opt\_wlan.h"{}}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/linker.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00045}00045 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <net/if.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <net/ethernet.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <net/if\_media.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <net80211/ieee80211\_var.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <net80211/ieee80211\_radiotap.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <net80211/ieee80211\_ratectl.h>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{if__rtwnvar_8h}{dev/rtwn/if\_rtwnvar.h}}>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12a__fw__cmd_8h}{dev/rtwn/rtl8812a/r12a\_fw\_cmd.h}}>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12a__rx__desc_8h}{dev/rtwn/rtl8812a/r12a\_rx\_desc.h}}>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12au_8h}{dev/rtwn/rtl8812a/usb/r12au.h}}>}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00061}00061 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00062}\mbox{\hyperlink{r12au_8h_a98f113b4fd718020a4805dfa681dc1a6}{00062}} \mbox{\hyperlink{r12au__rx_8c_a6f7a721da5d03e70e3ee42878dde1895}{r12au\_classify\_intr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structrtwn__softc}{rtwn\_softc}} *sc, \textcolor{keywordtype}{void} *buf, \textcolor{keywordtype}{int} len)}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00063}00063 \{}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00064}00064         \textcolor{keyword}{struct }\mbox{\hyperlink{structr92c__rx__stat}{r92c\_rx\_stat}} *stat = buf;}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00065}00065         uint32\_t \mbox{\hyperlink{if__rtwnreg_8h_a2a16b26bd93225a7d99afc23162963d3}{rxdw2}} = le32toh(stat-\/>\mbox{\hyperlink{structr92c__rx__stat_a9ba5f004e7759c4e27c2db3fb5243819}{rxdw2}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00067}00067         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__rtwnreg_8h_a2a16b26bd93225a7d99afc23162963d3}{rxdw2}} \& \mbox{\hyperlink{r12a__rx__desc_8h_a06051356b0eed7009e6b897c1bcb08b6}{R12A\_RXDW2\_RPT\_C2H}}) \{}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00068}00068                 \textcolor{keywordtype}{int} pos = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structr92c__rx__stat}{r92c\_rx\_stat}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00069}00069                 \textcolor{comment}{/* Check if Rx descriptor + command id/sequence fits. */}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00070}00070                 \textcolor{keywordflow}{if} (len < pos + 2)      \textcolor{comment}{/* unknown, skip */}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00071}00071                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{if__rtwnvar_8h_a06fc87d81c62e9abb8790b6e5713c55bab4f130226ceafea77f8cdfbb239a7a5d}{RTWN\_RX\_DATA}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00073}00073                 \textcolor{keywordflow}{if} (((uint8\_t *)buf)[pos] == \mbox{\hyperlink{r12a__fw__cmd_8h_ae0aac53ee97af2c3e1ec177603ba0539}{R12A\_C2H\_TX\_REPORT}})}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00074}00074                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{if__rtwnvar_8h_a06fc87d81c62e9abb8790b6e5713c55ba99421715c05735fc108bc3197a65d813}{RTWN\_RX\_TX\_REPORT}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00075}00075                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00076}00076                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{if__rtwnvar_8h_a06fc87d81c62e9abb8790b6e5713c55ba8aaae997664441b78baffdcbb2106087}{RTWN\_RX\_OTHER}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00077}00077         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00078}00078                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{if__rtwnvar_8h_a06fc87d81c62e9abb8790b6e5713c55bab4f130226ceafea77f8cdfbb239a7a5d}{RTWN\_RX\_DATA}});}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00079}00079 \}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00081}00081 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00082}\mbox{\hyperlink{r12au_8h_a523a183bede8983adfb58b07dfb264eb}{00082}} \mbox{\hyperlink{r12au__rx_8c_a16b531058f36954ad9dd7e0a0eda8bdc}{r12au\_align\_rx}}(\textcolor{keywordtype}{int} totlen, \textcolor{keywordtype}{int} len)}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00083}00083 \{}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00084}00084         \textcolor{keywordflow}{if} (totlen < len)}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00085}00085                 \textcolor{keywordflow}{return} (roundup2(totlen, 8));}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00087}00087         \textcolor{keywordflow}{return} (totlen);}
\DoxyCodeLine{\Hypertarget{r12au__rx_8c_source_l00088}00088 \}}

\end{DoxyCode}
