Home | History | Annotate | Line # | Download | only in ic
      1  1.1  degroote /*	$OpenBSD: malo.h,v 1.10 2010/08/08 16:36:33 deraadt Exp $ */
      2  1.1  degroote 
      3  1.1  degroote /*
      4  1.1  degroote  * Copyright (c) 2006 Claudio Jeker <claudio (at) openbsd.org>
      5  1.1  degroote  * Copyright (c) 2006 Marcus Glocker <mglocker (at) openbsd.org>
      6  1.1  degroote  *
      7  1.1  degroote  * Permission to use, copy, modify, and distribute this software for any
      8  1.1  degroote  * purpose with or without fee is hereby granted, provided that the above
      9  1.1  degroote  * copyright notice and this permission notice appear in all copies.
     10  1.1  degroote  *
     11  1.1  degroote  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  1.1  degroote  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  1.1  degroote  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  1.1  degroote  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  1.1  degroote  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  1.1  degroote  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  1.1  degroote  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  1.1  degroote  */
     19  1.1  degroote 
     20  1.1  degroote //#define MALO_DEBUG
     21  1.1  degroote 
     22  1.1  degroote struct malo_rx_desc;
     23  1.1  degroote struct malo_rx_data;
     24  1.1  degroote 
     25  1.1  degroote struct malo_rx_ring {
     26  1.1  degroote 	bus_dmamap_t		map;
     27  1.1  degroote 	bus_dma_segment_t	seg;
     28  1.1  degroote 	bus_addr_t		physaddr;
     29  1.1  degroote 	struct malo_rx_desc	*desc;
     30  1.1  degroote 	struct malo_rx_data	*data;
     31  1.1  degroote 	int			count;
     32  1.1  degroote 	int			cur;
     33  1.1  degroote 	int			next;
     34  1.1  degroote };
     35  1.1  degroote 
     36  1.1  degroote struct malo_tx_desc;
     37  1.1  degroote struct malo_tx_data;
     38  1.1  degroote 
     39  1.1  degroote struct malo_tx_ring {
     40  1.1  degroote 	bus_dmamap_t		map;
     41  1.1  degroote 	bus_dma_segment_t	seg;
     42  1.1  degroote 	bus_addr_t		physaddr;
     43  1.1  degroote 	struct malo_tx_desc	*desc;
     44  1.1  degroote 	struct malo_tx_data	*data;
     45  1.1  degroote 	int			count;
     46  1.1  degroote 	int			queued;
     47  1.1  degroote 	int			cur;
     48  1.1  degroote 	int			next;
     49  1.1  degroote 	int			stat;
     50  1.1  degroote };
     51  1.1  degroote 
     52  1.1  degroote // XXX Support for RSSI ?
     53  1.1  degroote #define MALO_RX_RADIOTAP_PRESENT					\
     54  1.1  degroote 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     55  1.1  degroote 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     56  1.1  degroote 
     57  1.1  degroote struct malo_rx_radiotap_hdr {
     58  1.1  degroote 	struct ieee80211_radiotap_header	wr_ihdr;
     59  1.1  degroote 	uint8_t					wr_flags;
     60  1.1  degroote 	uint16_t				wr_chan_freq;
     61  1.1  degroote 	uint16_t				wr_chan_flags;
     62  1.4       mrg };
     63  1.1  degroote 
     64  1.1  degroote #define MALO_TX_RADIOTAP_PRESENT					\
     65  1.1  degroote 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     66  1.1  degroote 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     67  1.1  degroote 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     68  1.1  degroote 
     69  1.1  degroote struct malo_tx_radiotap_hdr {
     70  1.1  degroote 	struct ieee80211_radiotap_header	wt_ihdr;
     71  1.1  degroote 	uint8_t					wt_flags;
     72  1.1  degroote 	uint8_t					wt_rate;
     73  1.1  degroote 	uint16_t				wt_chan_freq;
     74  1.1  degroote 	uint16_t				wt_chan_flags;
     75  1.4       mrg };
     76  1.1  degroote 
     77  1.1  degroote struct malo_softc {
     78  1.1  degroote 	device_t		sc_dev;
     79  1.3    nonaka 	struct ethercom		sc_ec;
     80  1.1  degroote 	struct ieee80211com	sc_ic;
     81  1.1  degroote #define sc_if sc_ec.ec_if
     82  1.3    nonaka 	void			*sc_soft_ih;
     83  1.1  degroote 	struct malo_rx_ring	sc_rxring;
     84  1.1  degroote 	struct malo_tx_ring	sc_txring;
     85  1.1  degroote 
     86  1.1  degroote 	bus_dma_tag_t		sc_dmat;
     87  1.1  degroote 	bus_space_tag_t		sc_mem1_bt;
     88  1.1  degroote 	bus_space_tag_t		sc_mem2_bt;
     89  1.1  degroote 	bus_space_handle_t	sc_mem1_bh;
     90  1.1  degroote 	bus_space_handle_t	sc_mem2_bh;
     91  1.1  degroote 
     92  1.1  degroote 	bus_dmamap_t		sc_cmd_dmam;
     93  1.1  degroote 	bus_dma_segment_t	sc_cmd_dmas;
     94  1.3    nonaka 	void			*sc_cmd_mem;
     95  1.1  degroote 	bus_addr_t		sc_cmd_dmaaddr;
     96  1.1  degroote 	uint32_t		*sc_cookie;
     97  1.1  degroote 	bus_addr_t		sc_cookie_dmaaddr;
     98  1.1  degroote 
     99  1.1  degroote 	uint32_t		sc_RxPdWrPtr;
    100  1.1  degroote 	uint32_t		sc_RxPdRdPtr;
    101  1.1  degroote 
    102  1.1  degroote 	int			(*sc_newstate)
    103  1.1  degroote 				(struct ieee80211com *,
    104  1.1  degroote 				 enum ieee80211_state, int);
    105  1.1  degroote 
    106  1.1  degroote 	int			(*sc_enable)(struct malo_softc *);
    107  1.1  degroote 	void			(*sc_disable)(struct malo_softc *);
    108  1.1  degroote 
    109  1.3    nonaka 	struct callout		sc_scan_to;
    110  1.1  degroote 	int			sc_tx_timer;
    111  1.1  degroote 	int			sc_last_txrate;
    112  1.1  degroote 
    113  1.1  degroote 	struct bpf_if *		sc_drvbpf;
    114  1.1  degroote 
    115  1.1  degroote 	union {
    116  1.1  degroote 		struct malo_rx_radiotap_hdr th;
    117  1.1  degroote 		uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
    118  1.1  degroote 	}		sc_rxtapu;
    119  1.1  degroote #define sc_rxtap	sc_rxtapu.th
    120  1.1  degroote 	int		sc_rxtap_len;
    121  1.1  degroote 
    122  1.1  degroote 	union {
    123  1.1  degroote 		struct malo_tx_radiotap_hdr th;
    124  1.1  degroote 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    125  1.1  degroote 	}		sc_txtapu;
    126  1.1  degroote #define sc_txtap	sc_txtapu.th
    127  1.1  degroote 	int		sc_txtap_len;
    128  1.1  degroote };
    129  1.1  degroote 
    130  1.1  degroote int malo_intr(void *arg);
    131  1.3    nonaka void malo_softintr(void *arg);
    132  1.1  degroote int malo_attach(struct malo_softc *sc);
    133  1.1  degroote int malo_detach(void *arg);
    134  1.2  degroote int malo_init(struct ifnet *);
    135  1.2  degroote void malo_stop(struct ifnet *, int disable);
    136