xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_beacon.c (revision 685dc743dc3b5645e34836464128e1c0558b404b)
1*7453645fSAndriy Voskoboinyk /*-
2*7453645fSAndriy Voskoboinyk  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
3*7453645fSAndriy Voskoboinyk  *
4*7453645fSAndriy Voskoboinyk  * Permission to use, copy, modify, and distribute this software for any
5*7453645fSAndriy Voskoboinyk  * purpose with or without fee is hereby granted, provided that the above
6*7453645fSAndriy Voskoboinyk  * copyright notice and this permission notice appear in all copies.
7*7453645fSAndriy Voskoboinyk  *
8*7453645fSAndriy Voskoboinyk  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*7453645fSAndriy Voskoboinyk  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*7453645fSAndriy Voskoboinyk  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*7453645fSAndriy Voskoboinyk  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*7453645fSAndriy Voskoboinyk  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*7453645fSAndriy Voskoboinyk  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*7453645fSAndriy Voskoboinyk  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*7453645fSAndriy Voskoboinyk  */
16*7453645fSAndriy Voskoboinyk 
17*7453645fSAndriy Voskoboinyk #include <sys/cdefs.h>
18*7453645fSAndriy Voskoboinyk #include "opt_wlan.h"
19*7453645fSAndriy Voskoboinyk 
20*7453645fSAndriy Voskoboinyk #include <sys/param.h>
21*7453645fSAndriy Voskoboinyk #include <sys/lock.h>
22*7453645fSAndriy Voskoboinyk #include <sys/mutex.h>
23*7453645fSAndriy Voskoboinyk #include <sys/mbuf.h>
24*7453645fSAndriy Voskoboinyk #include <sys/kernel.h>
25*7453645fSAndriy Voskoboinyk #include <sys/socket.h>
26*7453645fSAndriy Voskoboinyk #include <sys/systm.h>
27*7453645fSAndriy Voskoboinyk #include <sys/malloc.h>
28*7453645fSAndriy Voskoboinyk #include <sys/queue.h>
29*7453645fSAndriy Voskoboinyk #include <sys/taskqueue.h>
30*7453645fSAndriy Voskoboinyk #include <sys/bus.h>
31*7453645fSAndriy Voskoboinyk #include <sys/endian.h>
32*7453645fSAndriy Voskoboinyk #include <sys/linker.h>
33*7453645fSAndriy Voskoboinyk 
34*7453645fSAndriy Voskoboinyk #include <net/if.h>
35*7453645fSAndriy Voskoboinyk #include <net/ethernet.h>
36*7453645fSAndriy Voskoboinyk #include <net/if_media.h>
37*7453645fSAndriy Voskoboinyk 
38*7453645fSAndriy Voskoboinyk #include <net80211/ieee80211_var.h>
39*7453645fSAndriy Voskoboinyk #include <net80211/ieee80211_radiotap.h>
40*7453645fSAndriy Voskoboinyk 
41*7453645fSAndriy Voskoboinyk #include <dev/rtwn/if_rtwnvar.h>
42*7453645fSAndriy Voskoboinyk 
43*7453645fSAndriy Voskoboinyk #include <dev/rtwn/rtl8188e/r88e.h>
44*7453645fSAndriy Voskoboinyk #include <dev/rtwn/rtl8188e/r88e_reg.h>
45*7453645fSAndriy Voskoboinyk 
46*7453645fSAndriy Voskoboinyk void
r88e_beacon_enable(struct rtwn_softc * sc,int id,int enable)47*7453645fSAndriy Voskoboinyk r88e_beacon_enable(struct rtwn_softc *sc, int id, int enable)
48*7453645fSAndriy Voskoboinyk {
49*7453645fSAndriy Voskoboinyk 
50*7453645fSAndriy Voskoboinyk 	if (enable) {
51*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_MBID_NUM, 0, R88E_MBID_TXBCN_RPT(id));
52*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_BCN_CTRL(id),
53*7453645fSAndriy Voskoboinyk 		    0, R92C_BCN_CTRL_EN_BCN);
54*7453645fSAndriy Voskoboinyk 	} else {
55*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_MBID_NUM, R88E_MBID_TXBCN_RPT(id), 0);
56*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_BCN_CTRL(id),
57*7453645fSAndriy Voskoboinyk 		    R92C_BCN_CTRL_EN_BCN, 0);
58*7453645fSAndriy Voskoboinyk 	}
59*7453645fSAndriy Voskoboinyk }
60