if_wpivar.h revision 1.2.4.3 1 1.2.4.3 yamt /* $NetBSD: if_wpivar.h,v 1.2.4.3 2007/02/26 09:10:29 yamt Exp $ */
2 1.2.4.2 yamt
3 1.2.4.2 yamt /*-
4 1.2.4.2 yamt * Copyright (c) 2006
5 1.2.4.2 yamt * Damien Bergamini <damien.bergamini (at) free.fr>
6 1.2.4.2 yamt *
7 1.2.4.2 yamt * Permission to use, copy, modify, and distribute this software for any
8 1.2.4.2 yamt * purpose with or without fee is hereby granted, provided that the above
9 1.2.4.2 yamt * copyright notice and this permission notice appear in all copies.
10 1.2.4.2 yamt *
11 1.2.4.2 yamt * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 1.2.4.2 yamt * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 1.2.4.2 yamt * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 1.2.4.2 yamt * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 1.2.4.2 yamt * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 1.2.4.2 yamt * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 1.2.4.2 yamt * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 1.2.4.2 yamt */
19 1.2.4.2 yamt
20 1.2.4.2 yamt struct wpi_rx_radiotap_header {
21 1.2.4.2 yamt struct ieee80211_radiotap_header wr_ihdr;
22 1.2.4.2 yamt uint64_t wr_tsft;
23 1.2.4.2 yamt uint8_t wr_flags;
24 1.2.4.2 yamt uint8_t wr_rate;
25 1.2.4.2 yamt uint16_t wr_chan_freq;
26 1.2.4.2 yamt uint16_t wr_chan_flags;
27 1.2.4.2 yamt int8_t wr_dbm_antsignal;
28 1.2.4.2 yamt int8_t wr_dbm_antnoise;
29 1.2.4.2 yamt uint8_t wr_antenna;
30 1.2.4.2 yamt };
31 1.2.4.2 yamt
32 1.2.4.2 yamt #define WPI_RX_RADIOTAP_PRESENT \
33 1.2.4.2 yamt ((1 << IEEE80211_RADIOTAP_TSFT) | \
34 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_FLAGS) | \
35 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_RATE) | \
36 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_CHANNEL) | \
37 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
38 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \
39 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_ANTENNA))
40 1.2.4.2 yamt
41 1.2.4.2 yamt struct wpi_tx_radiotap_header {
42 1.2.4.2 yamt struct ieee80211_radiotap_header wt_ihdr;
43 1.2.4.2 yamt uint8_t wt_flags;
44 1.2.4.2 yamt uint8_t wt_rate;
45 1.2.4.2 yamt uint16_t wt_chan_freq;
46 1.2.4.2 yamt uint16_t wt_chan_flags;
47 1.2.4.2 yamt uint8_t wt_hwqueue;
48 1.2.4.2 yamt };
49 1.2.4.2 yamt
50 1.2.4.2 yamt #define WPI_TX_RADIOTAP_PRESENT \
51 1.2.4.2 yamt ((1 << IEEE80211_RADIOTAP_FLAGS) | \
52 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_RATE) | \
53 1.2.4.2 yamt (1 << IEEE80211_RADIOTAP_CHANNEL))
54 1.2.4.2 yamt
55 1.2.4.2 yamt struct wpi_dma_info {
56 1.2.4.3 yamt bus_dma_tag_t tag;
57 1.2.4.2 yamt bus_dmamap_t map;
58 1.2.4.2 yamt bus_dma_segment_t seg;
59 1.2.4.2 yamt bus_addr_t paddr;
60 1.2.4.2 yamt caddr_t vaddr;
61 1.2.4.2 yamt bus_size_t size;
62 1.2.4.2 yamt };
63 1.2.4.2 yamt
64 1.2.4.2 yamt struct wpi_tx_data {
65 1.2.4.2 yamt bus_dmamap_t map;
66 1.2.4.2 yamt struct mbuf *m;
67 1.2.4.2 yamt struct ieee80211_node *ni;
68 1.2.4.2 yamt };
69 1.2.4.2 yamt
70 1.2.4.2 yamt struct wpi_tx_ring {
71 1.2.4.2 yamt struct wpi_dma_info desc_dma;
72 1.2.4.2 yamt struct wpi_dma_info cmd_dma;
73 1.2.4.2 yamt struct wpi_tx_desc *desc;
74 1.2.4.2 yamt struct wpi_tx_cmd *cmd;
75 1.2.4.2 yamt struct wpi_tx_data *data;
76 1.2.4.2 yamt int qid;
77 1.2.4.2 yamt int count;
78 1.2.4.2 yamt int queued;
79 1.2.4.2 yamt int cur;
80 1.2.4.2 yamt };
81 1.2.4.2 yamt
82 1.2.4.3 yamt #define WPI_RBUF_COUNT (WPI_RX_RING_COUNT + 16)
83 1.2.4.3 yamt
84 1.2.4.3 yamt struct wpi_softc;
85 1.2.4.3 yamt
86 1.2.4.3 yamt struct wpi_rbuf {
87 1.2.4.3 yamt struct wpi_softc *sc;
88 1.2.4.3 yamt caddr_t vaddr;
89 1.2.4.3 yamt bus_addr_t paddr;
90 1.2.4.3 yamt SLIST_ENTRY(wpi_rbuf) next;
91 1.2.4.3 yamt };
92 1.2.4.3 yamt
93 1.2.4.2 yamt struct wpi_rx_data {
94 1.2.4.2 yamt struct mbuf *m;
95 1.2.4.2 yamt };
96 1.2.4.2 yamt
97 1.2.4.2 yamt struct wpi_rx_ring {
98 1.2.4.2 yamt struct wpi_dma_info desc_dma;
99 1.2.4.3 yamt struct wpi_dma_info buf_dma;
100 1.2.4.2 yamt uint32_t *desc;
101 1.2.4.2 yamt struct wpi_rx_data data[WPI_RX_RING_COUNT];
102 1.2.4.3 yamt struct wpi_rbuf rbuf[WPI_RBUF_COUNT];
103 1.2.4.3 yamt SLIST_HEAD(, wpi_rbuf) freelist;
104 1.2.4.2 yamt int cur;
105 1.2.4.2 yamt };
106 1.2.4.2 yamt
107 1.2.4.2 yamt struct wpi_node {
108 1.2.4.2 yamt struct ieee80211_node ni; /* must be the first */
109 1.2.4.2 yamt struct ieee80211_amrr_node amn;
110 1.2.4.2 yamt };
111 1.2.4.2 yamt
112 1.2.4.2 yamt struct wpi_softc {
113 1.2.4.2 yamt struct device sc_dev;
114 1.2.4.3 yamt struct ethercom sc_ec;
115 1.2.4.2 yamt struct ieee80211com sc_ic;
116 1.2.4.2 yamt int (*sc_newstate)(struct ieee80211com *,
117 1.2.4.2 yamt enum ieee80211_state, int);
118 1.2.4.3 yamt
119 1.2.4.2 yamt struct ieee80211_amrr amrr;
120 1.2.4.2 yamt
121 1.2.4.2 yamt uint32_t flags;
122 1.2.4.2 yamt #define WPI_FLAG_FW_INITED (1 << 0)
123 1.2.4.2 yamt
124 1.2.4.2 yamt bus_dma_tag_t sc_dmat;
125 1.2.4.2 yamt
126 1.2.4.2 yamt /* shared area */
127 1.2.4.2 yamt struct wpi_dma_info shared_dma;
128 1.2.4.2 yamt struct wpi_shared *shared;
129 1.2.4.2 yamt
130 1.2.4.2 yamt struct wpi_tx_ring txq[4];
131 1.2.4.2 yamt struct wpi_tx_ring cmdq;
132 1.2.4.2 yamt struct wpi_tx_ring svcq;
133 1.2.4.2 yamt struct wpi_rx_ring rxq;
134 1.2.4.2 yamt
135 1.2.4.2 yamt bus_space_tag_t sc_st;
136 1.2.4.2 yamt bus_space_handle_t sc_sh;
137 1.2.4.2 yamt void *sc_ih;
138 1.2.4.2 yamt pci_chipset_tag_t sc_pct;
139 1.2.4.2 yamt pcitag_t sc_pcitag;
140 1.2.4.2 yamt bus_size_t sc_sz;
141 1.2.4.2 yamt
142 1.2.4.2 yamt struct callout amrr_ch;
143 1.2.4.2 yamt
144 1.2.4.2 yamt struct wpi_config config;
145 1.2.4.2 yamt uint16_t pwr1[14];
146 1.2.4.2 yamt uint16_t pwr2[14];
147 1.2.4.2 yamt
148 1.2.4.2 yamt int sc_tx_timer;
149 1.2.4.2 yamt void *powerhook;
150 1.2.4.2 yamt
151 1.2.4.2 yamt #if NBPFILTER > 0
152 1.2.4.2 yamt caddr_t sc_drvbpf;
153 1.2.4.2 yamt
154 1.2.4.2 yamt union {
155 1.2.4.2 yamt struct wpi_rx_radiotap_header th;
156 1.2.4.2 yamt uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
157 1.2.4.2 yamt } sc_rxtapu;
158 1.2.4.2 yamt #define sc_rxtap sc_rxtapu.th
159 1.2.4.2 yamt int sc_rxtap_len;
160 1.2.4.2 yamt
161 1.2.4.2 yamt union {
162 1.2.4.2 yamt struct wpi_tx_radiotap_header th;
163 1.2.4.2 yamt uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
164 1.2.4.2 yamt } sc_txtapu;
165 1.2.4.2 yamt #define sc_txtap sc_txtapu.th
166 1.2.4.2 yamt int sc_txtap_len;
167 1.2.4.2 yamt #endif
168 1.2.4.2 yamt };
169