\hypertarget{ar5211__beacon_8c_source}{}\doxysection{ar5211\+\_\+beacon.\+c}
\label{ar5211__beacon_8c_source}\index{dev/ath/ath\_hal/ar5211/ar5211\_beacon.c@{dev/ath/ath\_hal/ar5211/ar5211\_beacon.c}}
\mbox{\hyperlink{ar5211__beacon_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: ISC}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2002-\/2008 Sam Leffler, Errno Consulting}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2002-\/2006 Atheros Communications, Inc.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00007}00007 \textcolor{comment}{ * Permission to use, copy, modify, and/or distribute this software for any}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00008}00008 \textcolor{comment}{ * purpose with or without fee is hereby granted, provided that the above}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00009}00009 \textcolor{comment}{ * copyright notice and this permission notice appear in all copies.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00011}00011 \textcolor{comment}{ * THE SOFTWARE IS PROVIDED "{}AS IS"{} AND THE AUTHOR DISCLAIMS ALL WARRANTIES}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00012}00012 \textcolor{comment}{ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00013}00013 \textcolor{comment}{ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00014}00014 \textcolor{comment}{ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00015}00015 \textcolor{comment}{ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00016}00016 \textcolor{comment}{ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00017}00017 \textcolor{comment}{ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00018}00018 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00019}00019 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00020}00020 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00021}00021 \textcolor{preprocessor}{\#include "{}opt\_ah.h"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00022}00022 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00023}00023 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{ah_8h}{ah.h}}"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00024}00024 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{ah__internal_8h}{ah\_internal.h}}"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00025}00025 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00026}00026 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{ar5211_8h}{ar5211/ar5211.h}}"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00027}00027 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{ar5211reg_8h}{ar5211/ar5211reg.h}}"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{ar5211desc_8h}{ar5211/ar5211desc.h}}"{}}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00030}00030 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00031}00031 \textcolor{comment}{ * Routines used to initialize and generated beacons for the AR5211/AR5311.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00034}00034 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00035}00035 \textcolor{comment}{ * Return the hardware NextTBTT in TSF}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00036}00036 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00037}00037 uint64\_t}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00038}\mbox{\hyperlink{ar5211_8h_a3b201f95a59c3655739f36df981bc309}{00038}} \mbox{\hyperlink{ar5211__beacon_8c_afb6bf730aafd54e1f31991048db2e9e2}{ar5211GetNextTBTT}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structath__hal}{ath\_hal}} *ah)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00039}00039 \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00040}00040 \textcolor{preprocessor}{\#define TU\_TO\_TSF(\_tu)  (((uint64\_t)(\_tu)) << 10)}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00041}00041         \textcolor{keywordflow}{return} \mbox{\hyperlink{ar5211__beacon_8c_a133f5325fa74b3f7d706fa02cfa81a32}{TU\_TO\_TSF}}(\mbox{\hyperlink{ah__osdep_8h_afded631196d59ba3443fc37addc9a2a6}{OS\_REG\_READ}}(ah, \mbox{\hyperlink{ar5210reg_8h_a64d2d2873e1e673728c7d79c7a67b811}{AR\_TIMER0}}));}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00042}00042 \textcolor{preprocessor}{\#undef TU\_TO\_TSF}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00043}00043 \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00045}00045 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00046}00046 \textcolor{comment}{ * Initialize all of the hardware registers used to send beacons.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00047}00047 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00048}00048 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00049}\mbox{\hyperlink{ar5211_8h_a64788445274b9c1c3d03073641c3e449}{00049}} \mbox{\hyperlink{ar5211__beacon_8c_ad3d9fde1696d0991e1141cca28bc79ca}{ar5211SetBeaconTimers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structath__hal}{ath\_hal}} *ah, \textcolor{keyword}{const} \mbox{\hyperlink{structHAL__BEACON__TIMERS}{HAL\_BEACON\_TIMERS}} *bt)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00050}00050 \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00052}00052         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a64d2d2873e1e673728c7d79c7a67b811}{AR\_TIMER0}}, bt-\/>\mbox{\hyperlink{structHAL__BEACON__TIMERS_aa04f40e657e0e8a52e83f6e9cd50f3cd}{bt\_nexttbtt}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00053}00053         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a9651e21f2bfa02428857a9545a3a22c7}{AR\_TIMER1}}, bt-\/>\mbox{\hyperlink{structHAL__BEACON__TIMERS_af7542f9bd348449318b6476594af69a8}{bt\_nextdba}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00054}00054         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_aa401df1b4df05ebd31b5cc970b213bf0}{AR\_TIMER2}}, bt-\/>\mbox{\hyperlink{structHAL__BEACON__TIMERS_afc9ad14a1a1e99c3d364f39454b75c74}{bt\_nextswba}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00055}00055         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_aa2f3458e713cb288674fedcc4bf81869}{AR\_TIMER3}}, bt-\/>\mbox{\hyperlink{structHAL__BEACON__TIMERS_a35da857d89372550c74a19767de86e60}{bt\_nextatim}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00056}00056         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00057}00057 \textcolor{comment}{         * Set the Beacon register after setting all timers.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00058}00058 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00059}00059         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a25442c5afbe0e1e1560e78d8f04afdea}{AR\_BEACON}}, bt-\/>\mbox{\hyperlink{structHAL__BEACON__TIMERS_a5abf718a3a3cfcbece67d7f3c980d609}{bt\_intval}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00060}00060 \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00062}00062 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00063}00063 \textcolor{comment}{ * Legacy api to initialize all of the beacon registers.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00064}00064 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00065}00065 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00066}\mbox{\hyperlink{ar5211_8h_a922bfc77ed98dbf82be609c182b0813b}{00066}} \mbox{\hyperlink{ar5211__beacon_8c_a638161ae8c79ab69eec94c9cadc9f969}{ar5211BeaconInit}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structath__hal}{ath\_hal}} *ah,}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00067}00067         uint32\_t next\_beacon, uint32\_t beacon\_period)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00068}00068 \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00069}00069         \mbox{\hyperlink{structHAL__BEACON__TIMERS}{HAL\_BEACON\_TIMERS}} bt;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00071}00071         bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_aa04f40e657e0e8a52e83f6e9cd50f3cd}{bt\_nexttbtt}} = next\_beacon;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00072}00072         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00073}00073 \textcolor{comment}{         * TIMER1: in AP/adhoc mode this controls the DMA beacon}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00074}00074 \textcolor{comment}{         * alert timer; otherwise it controls the next wakeup time.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00075}00075 \textcolor{comment}{         * TIMER2: in AP mode, it controls the SBA beacon alert}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00076}00076 \textcolor{comment}{         * interrupt; otherwise it sets the start of the next CFP.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00077}00077 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00078}00078         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{ah__internal_8h_a7a57bc6086e9d3ed4c9d81f5d0a136cc}{AH\_PRIVATE}}(ah)-\/>ah\_opmode) \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00079}00079         \textcolor{keywordflow}{case} \mbox{\hyperlink{ah_8h_a46d2f8970b742983f3248797883a77c3ab5bcbfc7b87ac33ac0da97127bbd6138}{HAL\_M\_STA}}:}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00080}00080         \textcolor{keywordflow}{case} \mbox{\hyperlink{ah_8h_a46d2f8970b742983f3248797883a77c3a9182c471b73c905660273a4b428ac753}{HAL\_M\_MONITOR}}:}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00081}00081                 bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_af7542f9bd348449318b6476594af69a8}{bt\_nextdba}} = 0xffff;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00082}00082                 bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_afc9ad14a1a1e99c3d364f39454b75c74}{bt\_nextswba}} = 0x7ffff;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00083}00083                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00084}00084         \textcolor{keywordflow}{case} \mbox{\hyperlink{ah_8h_a46d2f8970b742983f3248797883a77c3a0944a9d007b1d97b31eefcde3ff6e92a}{HAL\_M\_IBSS}}:}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00085}00085         \textcolor{keywordflow}{case} \mbox{\hyperlink{ah_8h_a46d2f8970b742983f3248797883a77c3ae7ab5162a6e449287d9e8c63a4c4e628}{HAL\_M\_HOSTAP}}:}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00086}00086                 bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_af7542f9bd348449318b6476594af69a8}{bt\_nextdba}} = (next\_beacon -\/}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00087}00087                         ah-\/>\mbox{\hyperlink{structath__hal_a7865226c677aa67240c2a04e7f64175a}{ah\_config}}.\mbox{\hyperlink{structHAL__OPS__CONFIG_a600bd20864a34c11d6187354bd66505b}{ah\_dma\_beacon\_response\_time}}) << 3;    \textcolor{comment}{/* 1/8 TU */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00088}00088                 bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_afc9ad14a1a1e99c3d364f39454b75c74}{bt\_nextswba}} = (next\_beacon -\/}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00089}00089             ah-\/>\mbox{\hyperlink{structath__hal_a7865226c677aa67240c2a04e7f64175a}{ah\_config}}.\mbox{\hyperlink{structHAL__OPS__CONFIG_a6e2e8cc16daa20d969e84eb1df13640c}{ah\_sw\_beacon\_response\_time}}) << 3;  \textcolor{comment}{/* 1/8 TU */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00090}00090                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00091}00091         \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00092}00092         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00093}00093 \textcolor{comment}{         * Set the ATIM window }}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00094}00094 \textcolor{comment}{         * Our hardware does not support an ATIM window of 0}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00095}00095 \textcolor{comment}{         * (beacons will not work).  If the ATIM windows is 0,}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00096}00096 \textcolor{comment}{         * force it to 1.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00097}00097 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00098}00098         bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_a35da857d89372550c74a19767de86e60}{bt\_nextatim}} = next\_beacon + 1;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00099}00099         bt.\mbox{\hyperlink{structHAL__BEACON__TIMERS_a5abf718a3a3cfcbece67d7f3c980d609}{bt\_intval}} = beacon\_period \&}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00100}00100                 (\mbox{\hyperlink{ar5210reg_8h_a1e08fac0ee9c372df4574a998da0a5af}{AR\_BEACON\_PERIOD}} | \mbox{\hyperlink{ar5210reg_8h_ab13f76484f387a0786c54d841041de9e}{AR\_BEACON\_RESET\_TSF}} | \mbox{\hyperlink{ar5210reg_8h_aaee1df3ac07714f7af017829af770e57}{AR\_BEACON\_EN}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00101}00101         \mbox{\hyperlink{ar5211__beacon_8c_ad3d9fde1696d0991e1141cca28bc79ca}{ar5211SetBeaconTimers}}(ah, \&bt);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00102}00102 \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00104}00104 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00105}\mbox{\hyperlink{ar5211_8h_aa089f093cf1cbd74619701a4d09c943e}{00105}} \mbox{\hyperlink{ar5211__beacon_8c_a50aaa8eb0fb914dec152607be1bbcd2c}{ar5211ResetStaBeaconTimers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structath__hal}{ath\_hal}} *ah)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00106}00106 \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00107}00107         uint32\_t val;}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00108}00108 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00109}00109         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a64d2d2873e1e673728c7d79c7a67b811}{AR\_TIMER0}}, 0);            \textcolor{comment}{/* no beacons */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00110}00110         val = \mbox{\hyperlink{ah__osdep_8h_afded631196d59ba3443fc37addc9a2a6}{OS\_REG\_READ}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00111}00111         val |= \mbox{\hyperlink{ar5211reg_8h_a6c6c19768dea12f1ac5c60b8e0369530}{AR\_STA\_ID1\_PWR\_SAV}};            \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00112}00112         \textcolor{comment}{/* tell the h/w that the associated AP is not PCF capable */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00113}00113         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}},}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00114}00114                 val \& \string~(\mbox{\hyperlink{ar5210reg_8h_af7f644f04e528237c3d2b1e2afc0d610}{AR\_STA\_ID1\_DEFAULT\_ANTENNA}} | \mbox{\hyperlink{ar5210reg_8h_a6910c50e19bc12f0eb88855eeede564a}{AR\_STA\_ID1\_PCF}}));}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00115}00115         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a25442c5afbe0e1e1560e78d8f04afdea}{AR\_BEACON}}, \mbox{\hyperlink{ar5210reg_8h_a1e08fac0ee9c372df4574a998da0a5af}{AR\_BEACON\_PERIOD}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00116}00116 \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00118}00118 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00119}00119 \textcolor{comment}{ * Set all the beacon related bits on the h/w for stations}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00120}00120 \textcolor{comment}{ * i.e. initializes the corresponding h/w timers;}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00121}00121 \textcolor{comment}{ * also tells the h/w whether to anticipate PCF beacons}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00122}00122 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00123}00123 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00124}\mbox{\hyperlink{ar5211_8h_a2e9344a1ef19d7d9e217987b64337556}{00124}} \mbox{\hyperlink{ar5211__beacon_8c_ab8acd789e76717707f5b521b727c8888}{ar5211SetStaBeaconTimers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structath__hal}{ath\_hal}} *ah, \textcolor{keyword}{const} \mbox{\hyperlink{structHAL__BEACON__STATE}{HAL\_BEACON\_STATE}} *bs)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00125}00125 \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00126}00126         \textcolor{keyword}{struct }\mbox{\hyperlink{structath__hal__5211}{ath\_hal\_5211}} *ahp = \mbox{\hyperlink{ar5211_8h_aba490419ff25bbeb9727b9a7b3f653ba}{AH5211}}(ah);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00127}00127 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00128}00128         \mbox{\hyperlink{ah__internal_8h_ac09ac07206a85dc5f4079553a0520c4e}{HALDEBUG}}(ah, \mbox{\hyperlink{ah__debug_8h_a61dadd085c1777f559549e05962b2c9eaa07a0774eff4f545878a5b0287384017}{HAL\_DEBUG\_BEACON}}, \textcolor{stringliteral}{"{}\%s: setting beacon timers\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00130}00130         \mbox{\hyperlink{ah__internal_8h_abb8bdaf7438fdc315b333ab07ed68c9c}{HALASSERT}}(bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_ab60d6a493fa6477cd36ddf8d2659e45c}{bs\_intval}} != 0);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00131}00131         \textcolor{comment}{/* if the AP will do PCF */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00132}00132         \textcolor{keywordflow}{if} (bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a06ad2d532c5dae123c70a0816cf88092}{bs\_cfpmaxduration}} != 0) \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00133}00133                 \textcolor{comment}{/* tell the h/w that the associated AP is PCF capable */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00134}00134                 \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}},}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00135}00135                         \mbox{\hyperlink{ah__osdep_8h_afded631196d59ba3443fc37addc9a2a6}{OS\_REG\_READ}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}}) | \mbox{\hyperlink{ar5210reg_8h_a6910c50e19bc12f0eb88855eeede564a}{AR\_STA\_ID1\_PCF}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00137}00137                 \textcolor{comment}{/* set CFP\_PERIOD(1.024ms) register */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00138}00138                 \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_aaf09d88c4d8fb668af4c367e2ee81593}{AR\_CFP\_PERIOD}}, bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a564fa4828aa9f6a768830ca147f2d8ba}{bs\_cfpperiod}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00139}00139 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00140}00140                 \textcolor{comment}{/* set CFP\_DUR(1.024ms) register to max cfp duration */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00141}00141                 \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_ac5f77943c5cc766c2dafffc0a278570d}{AR\_CFP\_DUR}}, bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a06ad2d532c5dae123c70a0816cf88092}{bs\_cfpmaxduration}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00143}00143                 \textcolor{comment}{/* set TIMER2(128us) to anticipated time of next CFP */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00144}00144                 \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_aa401df1b4df05ebd31b5cc970b213bf0}{AR\_TIMER2}}, bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_af44b168dbde974ec23c9d3b5c22bef87}{bs\_cfpnext}} << 3);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00145}00145         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00146}00146                 \textcolor{comment}{/* tell the h/w that the associated AP is not PCF capable */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00147}00147                 \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}},}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00148}00148                         \mbox{\hyperlink{ah__osdep_8h_afded631196d59ba3443fc37addc9a2a6}{OS\_REG\_READ}}(ah, \mbox{\hyperlink{ar5210reg_8h_a3449425878b8a4ad684aa58673c97f9e}{AR\_STA\_ID1}}) \&\string~ \mbox{\hyperlink{ar5210reg_8h_a6910c50e19bc12f0eb88855eeede564a}{AR\_STA\_ID1\_PCF}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00149}00149         \}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00150}00150 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00151}00151         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00152}00152 \textcolor{comment}{         * Set TIMER0(1.024ms) to the anticipated time of the next beacon.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00153}00153 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00154}00154         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a64d2d2873e1e673728c7d79c7a67b811}{AR\_TIMER0}}, bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_af2a67fbf7d77fd6fda78e2e7b73e2e87}{bs\_nexttbtt}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00156}00156         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00157}00157 \textcolor{comment}{         * Start the beacon timers by setting the BEACON register}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00158}00158 \textcolor{comment}{         * to the beacon interval; also write the tim offset which}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00159}00159 \textcolor{comment}{         * we should know by now.  The code, in ar5211WriteAssocid,}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00160}00160 \textcolor{comment}{         * also sets the tim offset once the AID is known which can}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00161}00161 \textcolor{comment}{         * be left as such for now.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00162}00162 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00163}00163         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_a25442c5afbe0e1e1560e78d8f04afdea}{AR\_BEACON}}, }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00164}00164                 (\mbox{\hyperlink{ah__osdep_8h_afded631196d59ba3443fc37addc9a2a6}{OS\_REG\_READ}}(ah, \mbox{\hyperlink{ar5210reg_8h_a25442c5afbe0e1e1560e78d8f04afdea}{AR\_BEACON}}) \&\string~ (\mbox{\hyperlink{ar5210reg_8h_a1e08fac0ee9c372df4574a998da0a5af}{AR\_BEACON\_PERIOD}}|\mbox{\hyperlink{ar5210reg_8h_a9f4e8225135dc57fe3e63b1a1f8747aa}{AR\_BEACON\_TIM}}))}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00165}00165                 | \mbox{\hyperlink{ah__internal_8h_a3219d5c091f63b52ee0ceba3969ba8c1}{SM}}(bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_ab60d6a493fa6477cd36ddf8d2659e45c}{bs\_intval}}, \mbox{\hyperlink{ar5210reg_8h_a1e08fac0ee9c372df4574a998da0a5af}{AR\_BEACON\_PERIOD}})}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00166}00166                 | \mbox{\hyperlink{ah__internal_8h_a3219d5c091f63b52ee0ceba3969ba8c1}{SM}}(bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a2ba450c847866f164ddfce08b4fe9dd7}{bs\_timoffset}} ? bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a2ba450c847866f164ddfce08b4fe9dd7}{bs\_timoffset}} + 4 : 0, \mbox{\hyperlink{ar5210reg_8h_a9f4e8225135dc57fe3e63b1a1f8747aa}{AR\_BEACON\_TIM}})}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00167}00167         );}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00168}00168 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00169}00169         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00170}00170 \textcolor{comment}{         * Configure the BMISS interrupt.  Note that we}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00171}00171 \textcolor{comment}{         * assume the caller blocks interrupts while enabling}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00172}00172 \textcolor{comment}{         * the threshold.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00173}00173 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00174}00174         \mbox{\hyperlink{ah__internal_8h_abb8bdaf7438fdc315b333ab07ed68c9c}{HALASSERT}}(bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_ae173530e91c814fc18c003e792865f0d}{bs\_bmissthreshold}} <= \mbox{\hyperlink{ah__internal_8h_a3cb92725e12650d7447b06c9db39aac9}{MS}}(0xffffffff, \mbox{\hyperlink{ar5210reg_8h_ae0e16aaa965fe587154a682b266eb5f6}{AR\_RSSI\_THR\_BM\_THR}}));}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00175}00175         ahp-\/>\mbox{\hyperlink{structath__hal__5211_a11a0da430343e897c3f500e6771d5a23}{ah\_rssiThr}} = (ahp-\/>\mbox{\hyperlink{structath__hal__5211_a11a0da430343e897c3f500e6771d5a23}{ah\_rssiThr}} \&\string~ AR\_RSSI\_THR\_BM\_THR)}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00176}00176                         | \mbox{\hyperlink{ah__internal_8h_a3219d5c091f63b52ee0ceba3969ba8c1}{SM}}(bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_ae173530e91c814fc18c003e792865f0d}{bs\_bmissthreshold}}, \mbox{\hyperlink{ar5210reg_8h_ae0e16aaa965fe587154a682b266eb5f6}{AR\_RSSI\_THR\_BM\_THR}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00177}00177         \mbox{\hyperlink{ah__osdep_8h_a8e19d34bdc4596d48a978fc59e1b60fb}{OS\_REG\_WRITE}}(ah, \mbox{\hyperlink{ar5210reg_8h_adc0111d531ffdb2bec209f7baa1b66c4}{AR\_RSSI\_THR}}, ahp-\/>\mbox{\hyperlink{structath__hal__5211_a11a0da430343e897c3f500e6771d5a23}{ah\_rssiThr}});}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00178}00178 }
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00179}00179         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00180}00180 \textcolor{comment}{         * Set the sleep duration in 1/8 TU's.}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00181}00181 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00182}00182 \textcolor{preprocessor}{\#define SLEEP\_SLOP      3}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00183}00183         \mbox{\hyperlink{ah__internal_8h_ab80ff599cda88f9223505d0ecbb53bcd}{OS\_REG\_RMW\_FIELD}}(ah, \mbox{\hyperlink{ar5210reg_8h_a07e7029bd20f0a3a2a43301bf9a008b8}{AR\_SCR}}, \mbox{\hyperlink{ar5210reg_8h_a0c1084201fa1d0ec07ce75bf37b17559}{AR\_SCR\_SLDUR}},}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00184}00184                 (bs-\/>\mbox{\hyperlink{structHAL__BEACON__STATE_a1b1b79b17ac2c28738a9f6da99513bef}{bs\_sleepduration}} -\/ \mbox{\hyperlink{ar5211__beacon_8c_a8ff621f3362085caeb55dba7a40659ed}{SLEEP\_SLOP}}) << 3);}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00185}00185 \textcolor{preprocessor}{\#undef SLEEP\_SLOP}}
\DoxyCodeLine{\Hypertarget{ar5211__beacon_8c_source_l00186}00186 \}}

\end{DoxyCode}
