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 * $FreeBSD$
19 */
20
21#ifndef RTL8192C_H
22#define RTL8192C_H
23
24/*
25 * Global definitions.
26 */
27#define R92C_TXPKTBUF_COUNT	256
28
29#define R92C_TX_PAGE_SIZE	128
30#define R92C_RX_DMA_BUFFER_SIZE	0x2800
31
32#define R92C_MAX_FW_SIZE	0x4000
33#define R92C_MACID_MAX		31
34#define R92C_CAM_ENTRY_COUNT	32
35
36#define R92C_CALIB_THRESHOLD	2
37
38/*
39 * Function declarations.
40 */
41/* r92c_attach.c */
42void	r92c_detach_private(struct rtwn_softc *);
43void	r92c_read_chipid_vendor(struct rtwn_softc *, uint32_t);
44
45/* r92c_beacon.c */
46void	r92c_beacon_init(struct rtwn_softc *, void *, int);
47void	r92c_beacon_enable(struct rtwn_softc *, int, int);
48
49/* r92c_calib.c */
50void	r92c_iq_calib(struct rtwn_softc *);
51void	r92c_lc_calib(struct rtwn_softc *);
52void	r92c_temp_measure(struct rtwn_softc *);
53uint8_t	r92c_temp_read(struct rtwn_softc *);
54
55/* r92c_chan.c */
56void	r92c_get_txpower(struct rtwn_softc *, int,
57	    struct ieee80211_channel *, uint8_t[]);
58void	r92c_write_txpower(struct rtwn_softc *, int,
59	    uint8_t power[]);
60void	r92c_set_bw20(struct rtwn_softc *, uint8_t);
61void	r92c_set_chan(struct rtwn_softc *, struct ieee80211_channel *);
62void	r92c_set_gain(struct rtwn_softc *, uint8_t);
63void	r92c_scan_start(struct ieee80211com *);
64void	r92c_scan_end(struct ieee80211com *);
65
66/* r92c_fw.c */
67#ifndef RTWN_WITHOUT_UCODE
68void	r92c_fw_reset(struct rtwn_softc *, int);
69void	r92c_fw_download_enable(struct rtwn_softc *, int);
70#endif
71void	r92c_joinbss_rpt(struct rtwn_softc *, int);
72#ifndef RTWN_WITHOUT_UCODE
73int	r92c_set_rsvd_page(struct rtwn_softc *, int, int, int);
74int	r92c_set_pwrmode(struct rtwn_softc *, struct ieee80211vap *, int);
75void	r92c_set_rssi(struct rtwn_softc *);
76void	r92c_handle_c2h_report(void *);
77#endif
78
79/* r92c_init.c */
80int	r92c_check_condition(struct rtwn_softc *, const uint8_t[]);
81int	r92c_llt_init(struct rtwn_softc *);
82int	r92c_set_page_size(struct rtwn_softc *);
83void	r92c_init_bb_common(struct rtwn_softc *);
84int	r92c_init_rf_chain(struct rtwn_softc *,
85	    const struct rtwn_rf_prog *, int);
86void	r92c_init_rf(struct rtwn_softc *);
87void	r92c_init_edca(struct rtwn_softc *);
88void	r92c_init_ampdu(struct rtwn_softc *);
89void	r92c_init_antsel(struct rtwn_softc *);
90void	r92c_pa_bias_init(struct rtwn_softc *);
91
92/* r92c_llt.c */
93int	r92c_llt_write(struct rtwn_softc *, uint32_t, uint32_t);
94
95/* r92c_rf.c */
96uint32_t	r92c_rf_read(struct rtwn_softc *, int, uint8_t);
97void		r92c_rf_write(struct rtwn_softc *, int, uint8_t, uint32_t);
98
99/* r92c_rom.c */
100void	r92c_efuse_postread(struct rtwn_softc *);
101void	r92c_parse_rom(struct rtwn_softc *, uint8_t *);
102
103/* r92c_rx.c */
104int	r92c_classify_intr(struct rtwn_softc *, void *, int);
105int8_t	r92c_get_rssi_cck(struct rtwn_softc *, void *);
106int8_t	r92c_get_rssi_ofdm(struct rtwn_softc *, void *);
107uint8_t	r92c_rx_radiotap_flags(const void *);
108void	r92c_get_rx_stats(struct rtwn_softc *, struct ieee80211_rx_stats *,
109	    const void *, const void *);
110
111/* r92c_tx.c */
112void	r92c_tx_enable_ampdu(void *, int);
113void	r92c_tx_setup_hwseq(void *);
114void	r92c_tx_setup_macid(void *, int);
115void	r92c_fill_tx_desc(struct rtwn_softc *, struct ieee80211_node *,
116	    struct mbuf *, void *, uint8_t, int);
117void	r92c_fill_tx_desc_raw(struct rtwn_softc *, struct ieee80211_node *,
118	    struct mbuf *, void *, const struct ieee80211_bpf_params *);
119void	r92c_fill_tx_desc_null(struct rtwn_softc *, void *, int, int, int);
120uint8_t	r92c_tx_radiotap_flags(const void *);
121
122#endif	/* RTL8192C_H */
123