rtwnvar.h revision 1.5
1/* $OpenBSD: rtwnvar.h,v 1.5 2016/03/21 12:00:32 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 int (*tx)(void *, struct mbuf *, struct ieee80211_node *); 31 int (*dma_init)(void *); 32 void (*enable_intr)(void *); 33 void (*disable_intr)(void *); 34 void (*stop)(void *); 35 int (*is_oactive)(void *); 36 void (*next_calib)(void *); 37 void (*cancel_calib)(void *); 38 void (*next_scan)(void *); 39 void (*cancel_scan)(void *); 40}; 41 42struct rtwn_softc { 43 /* sc_ops must be initialized by the attachment driver! */ 44 struct rtwn_ops sc_ops; 45 46 struct device *sc_pdev; 47 struct ieee80211com sc_ic; 48 int (*sc_newstate)(struct ieee80211com *, 49 enum ieee80211_state, int); 50 struct task init_task; 51 int ac2idx[EDCA_NUM_AC]; 52 uint32_t sc_flags; 53#define RTWN_FLAG_CCK_HIPWR 0x01 54#define RTWN_FLAG_BUSY 0x02 55 56 uint32_t chip; 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#define RTWN_CHIP_88C 0x10 62#define RTWN_CHIP_88E 0x20 63 64 uint8_t board_type; 65 uint8_t regulatory; 66 uint8_t pa_setting; 67 int avg_pwdb; 68 int thcal_state; 69 int thcal_lctemp; 70 int ntxchains; 71 int nrxchains; 72 int ledlink; 73 74 int sc_tx_timer; 75 int fwcur; 76 struct r92c_rom rom; 77 78 uint32_t rf_chnlbw[R92C_MAX_CHAINS]; 79}; 80 81int rtwn_attach(struct device *, struct rtwn_softc *, uint32_t); 82int rtwn_detach(struct rtwn_softc *, int); 83int rtwn_activate(struct rtwn_softc *, int); 84int8_t rtwn_get_rssi(struct rtwn_softc *, int, void *); 85void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); 86void rtwn_calib(struct rtwn_softc *); 87void rtwn_next_scan(struct rtwn_softc *); 88