xref: /freebsd/sys/dev/rtwn/rtl8192c/r92c.h (revision dd21556857e8d40f66bf5ad54754d9d52669ebf7)
1 /*-
2  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
3  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $
18  */
19 
20 #ifndef RTL8192C_H
21 #define RTL8192C_H
22 
23 #include <dev/rtwn/if_rtwn_ridx.h>
24 
25 /*
26  * Global definitions.
27  */
28 #define R92C_TXPKTBUF_COUNT	256
29 
30 #define R92C_TX_PAGE_SIZE	128
31 #define R92C_RX_DMA_BUFFER_SIZE	0x2800
32 
33 #define R92C_MAX_FW_SIZE	0x4000
34 #define R92C_MACID_MAX		31
35 #define R92C_CAM_ENTRY_COUNT	32
36 
37 #define R92C_CALIB_THRESHOLD	2
38 
39 /*
40  * Function declarations.
41  */
42 /* r92c_attach.c */
43 void	r92c_detach_private(struct rtwn_softc *);
44 void	r92c_read_chipid_vendor(struct rtwn_softc *, uint32_t);
45 
46 /* r92c_beacon.c */
47 void	r92c_beacon_init(struct rtwn_softc *, void *, int);
48 void	r92c_beacon_enable(struct rtwn_softc *, int, int);
49 void	r92c_sta_beacon_enable(struct rtwn_softc *, int, bool);
50 
51 /* r92c_calib.c */
52 void	r92c_iq_calib(struct rtwn_softc *);
53 void	r92c_lc_calib(struct rtwn_softc *);
54 void	r92c_temp_measure(struct rtwn_softc *);
55 uint8_t	r92c_temp_read(struct rtwn_softc *);
56 
57 /* r92c_chan.c */
58 void	r92c_dump_txpower(struct rtwn_softc *, int, uint8_t[RTWN_RIDX_COUNT]);
59 void	r92c_get_txpower(struct rtwn_softc *, int,
60 	    struct ieee80211_channel *, uint8_t[RTWN_RIDX_COUNT]);
61 void	r92c_write_txpower(struct rtwn_softc *, int,
62 	    uint8_t power[RTWN_RIDX_COUNT]);
63 int	r92c_set_tx_power(struct rtwn_softc *, struct ieee80211vap *);
64 void	r92c_set_bw20(struct rtwn_softc *, uint8_t);
65 void	r92c_set_chan(struct rtwn_softc *, struct ieee80211_channel *);
66 void	r92c_set_gain(struct rtwn_softc *, uint8_t);
67 void	r92c_scan_start(struct ieee80211com *);
68 void	r92c_scan_end(struct ieee80211com *);
69 
70 /* r92c_fw.c */
71 #ifndef RTWN_WITHOUT_UCODE
72 void	r92c_fw_reset(struct rtwn_softc *, int);
73 void	r92c_fw_download_enable(struct rtwn_softc *, int);
74 #endif
75 void	r92c_joinbss_rpt(struct rtwn_softc *, int);
76 #ifndef RTWN_WITHOUT_UCODE
77 int	r92c_set_rsvd_page(struct rtwn_softc *, int, int, int);
78 int	r92c_set_pwrmode(struct rtwn_softc *, struct ieee80211vap *, int);
79 void	r92c_set_rssi(struct rtwn_softc *);
80 void	r92c_handle_c2h_report(void *);
81 #endif
82 
83 /* r92c_init.c */
84 int	r92c_check_condition(struct rtwn_softc *, const uint8_t[]);
85 int	r92c_llt_init(struct rtwn_softc *);
86 int	r92c_set_page_size(struct rtwn_softc *);
87 void	r92c_init_bb_common(struct rtwn_softc *);
88 int	r92c_init_rf_chain(struct rtwn_softc *,
89 	    const struct rtwn_rf_prog *, int);
90 void	r92c_init_rf(struct rtwn_softc *);
91 void	r92c_init_edca(struct rtwn_softc *);
92 void	r92c_init_ampdu(struct rtwn_softc *);
93 void	r92c_init_antsel(struct rtwn_softc *);
94 void	r92c_pa_bias_init(struct rtwn_softc *);
95 
96 /* r92c_llt.c */
97 int	r92c_llt_write(struct rtwn_softc *, uint32_t, uint32_t);
98 
99 /* r92c_rf.c */
100 uint32_t	r92c_rf_read(struct rtwn_softc *, int, uint8_t);
101 void		r92c_rf_write(struct rtwn_softc *, int, uint8_t, uint32_t);
102 
103 /* r92c_rom.c */
104 void	r92c_efuse_postread(struct rtwn_softc *);
105 void	r92c_parse_rom(struct rtwn_softc *, uint8_t *);
106 
107 /* r92c_rx.c */
108 int	r92c_classify_intr(struct rtwn_softc *, void *, int);
109 int8_t	r92c_get_rssi_cck(struct rtwn_softc *, void *);
110 int8_t	r92c_get_rssi_ofdm(struct rtwn_softc *, void *);
111 uint8_t	r92c_rx_radiotap_flags(const void *);
112 void	r92c_get_rx_stats(struct rtwn_softc *, struct ieee80211_rx_stats *,
113 	    const void *, const void *);
114 
115 /* r92c_tx.c */
116 void	r92c_tx_enable_ampdu(void *, int);
117 void	r92c_tx_setup_hwseq(void *);
118 void	r92c_tx_setup_macid(void *, int);
119 void	r92c_fill_tx_desc(struct rtwn_softc *, struct ieee80211_node *,
120 	    struct mbuf *, void *, uint8_t, bool, int);
121 void	r92c_fill_tx_desc_raw(struct rtwn_softc *, struct ieee80211_node *,
122 	    struct mbuf *, void *, const struct ieee80211_bpf_params *);
123 void	r92c_fill_tx_desc_null(struct rtwn_softc *, void *, int, int, int);
124 uint8_t	r92c_tx_radiotap_flags(const void *);
125 
126 #endif	/* RTL8192C_H */
127