xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_beacon.c (revision 7453645f2a9411a3f9d982b768bcc323f41cf906)
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 __FBSDID("$FreeBSD$");
19*7453645fSAndriy Voskoboinyk 
20*7453645fSAndriy Voskoboinyk #include "opt_wlan.h"
21*7453645fSAndriy Voskoboinyk 
22*7453645fSAndriy Voskoboinyk #include <sys/param.h>
23*7453645fSAndriy Voskoboinyk #include <sys/lock.h>
24*7453645fSAndriy Voskoboinyk #include <sys/mutex.h>
25*7453645fSAndriy Voskoboinyk #include <sys/mbuf.h>
26*7453645fSAndriy Voskoboinyk #include <sys/kernel.h>
27*7453645fSAndriy Voskoboinyk #include <sys/socket.h>
28*7453645fSAndriy Voskoboinyk #include <sys/systm.h>
29*7453645fSAndriy Voskoboinyk #include <sys/malloc.h>
30*7453645fSAndriy Voskoboinyk #include <sys/queue.h>
31*7453645fSAndriy Voskoboinyk #include <sys/taskqueue.h>
32*7453645fSAndriy Voskoboinyk #include <sys/bus.h>
33*7453645fSAndriy Voskoboinyk #include <sys/endian.h>
34*7453645fSAndriy Voskoboinyk #include <sys/linker.h>
35*7453645fSAndriy Voskoboinyk 
36*7453645fSAndriy Voskoboinyk #include <net/if.h>
37*7453645fSAndriy Voskoboinyk #include <net/ethernet.h>
38*7453645fSAndriy Voskoboinyk #include <net/if_media.h>
39*7453645fSAndriy Voskoboinyk 
40*7453645fSAndriy Voskoboinyk #include <net80211/ieee80211_var.h>
41*7453645fSAndriy Voskoboinyk #include <net80211/ieee80211_radiotap.h>
42*7453645fSAndriy Voskoboinyk 
43*7453645fSAndriy Voskoboinyk #include <dev/rtwn/if_rtwnvar.h>
44*7453645fSAndriy Voskoboinyk 
45*7453645fSAndriy Voskoboinyk #include <dev/rtwn/rtl8188e/r88e.h>
46*7453645fSAndriy Voskoboinyk #include <dev/rtwn/rtl8188e/r88e_reg.h>
47*7453645fSAndriy Voskoboinyk 
48*7453645fSAndriy Voskoboinyk 
49*7453645fSAndriy Voskoboinyk void
50*7453645fSAndriy Voskoboinyk r88e_beacon_enable(struct rtwn_softc *sc, int id, int enable)
51*7453645fSAndriy Voskoboinyk {
52*7453645fSAndriy Voskoboinyk 
53*7453645fSAndriy Voskoboinyk 	if (enable) {
54*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_MBID_NUM, 0, R88E_MBID_TXBCN_RPT(id));
55*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_BCN_CTRL(id),
56*7453645fSAndriy Voskoboinyk 		    0, R92C_BCN_CTRL_EN_BCN);
57*7453645fSAndriy Voskoboinyk 	} else {
58*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_MBID_NUM, R88E_MBID_TXBCN_RPT(id), 0);
59*7453645fSAndriy Voskoboinyk 		rtwn_setbits_1(sc, R92C_BCN_CTRL(id),
60*7453645fSAndriy Voskoboinyk 		    R92C_BCN_CTRL_EN_BCN, 0);
61*7453645fSAndriy Voskoboinyk 	}
62*7453645fSAndriy Voskoboinyk }
63