rtwnvar.h revision 1.1
1/* $OpenBSD: rtwnvar.h,v 1.1 2016/03/09 18:18:28 stsp Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20/* Operations provided by bus-specific attachment drivers. */ 21struct rtwn_ops { 22 void *cookie; /* Attachment driver's private data. */ 23 24 uint8_t (*read_1)(void *, uint16_t); 25 uint16_t (*read_2)(void *, uint16_t); 26 uint32_t (*read_4)(void *, uint16_t); 27 void (*write_1)(void *, uint16_t, uint8_t); 28 void (*write_2)(void *, uint16_t, uint16_t); 29 void (*write_4)(void *, uint16_t, uint32_t); 30 void (*next_scan)(void *); 31 int (*tx)(void *, struct mbuf *, struct ieee80211_node *); 32 int (*configure_dma)(void *); 33 void (*enable_intr)(void *); 34 void (*disable_intr)(void *); 35 void (*stop)(void *); 36 int (*is_oactive)(void *); 37}; 38 39struct rtwn_softc { 40 /* sc_ops must be initialized by the attachment driver! */ 41 struct rtwn_ops sc_ops; 42 43 struct device *sc_pdev; 44 struct ieee80211com sc_ic; 45 int (*sc_newstate)(struct ieee80211com *, 46 enum ieee80211_state, int); 47 struct timeout scan_to; 48 struct timeout calib_to; 49 struct task init_task; 50 int ac2idx[EDCA_NUM_AC]; 51 u_int sc_flags; 52#define RTWN_FLAG_CCK_HIPWR 0x01 53#define RTWN_FLAG_BUSY 0x02 54 55 u_int chip; 56#define RTWN_CHIP_88C 0x00 57#define RTWN_CHIP_92C 0x01 58#define RTWN_CHIP_92C_1T2R 0x02 59#define RTWN_CHIP_UMC 0x04 60#define RTWN_CHIP_UMC_A_CUT 0x08 61 62 uint8_t board_type; 63 uint8_t regulatory; 64 uint8_t pa_setting; 65 int avg_pwdb; 66 int thcal_state; 67 int thcal_lctemp; 68 int ntxchains; 69 int nrxchains; 70 int ledlink; 71 72 int sc_tx_timer; 73 int fwcur; 74 struct r92c_rom rom; 75 76 uint32_t rf_chnlbw[R92C_MAX_CHAINS]; 77}; 78 79void rtwn_attach(struct device *, struct rtwn_softc *); 80int rtwn_detach(struct rtwn_softc *, int); 81int rtwn_activate(struct rtwn_softc *, int); 82int8_t rtwn_get_rssi(struct rtwn_softc *, int, void *); 83void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); 84