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