if_wpivar.h revision 1.2 1 1.2 joerg /* $NetBSD: if_wpivar.h,v 1.2 2006/10/31 21:53:41 joerg 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.1 simonb bus_dmamap_t map;
57 1.1 simonb bus_dma_segment_t seg;
58 1.1 simonb bus_addr_t paddr;
59 1.1 simonb caddr_t vaddr;
60 1.1 simonb bus_size_t size;
61 1.1 simonb };
62 1.1 simonb
63 1.1 simonb struct wpi_tx_data {
64 1.1 simonb bus_dmamap_t map;
65 1.1 simonb struct mbuf *m;
66 1.1 simonb struct ieee80211_node *ni;
67 1.1 simonb };
68 1.1 simonb
69 1.1 simonb struct wpi_tx_ring {
70 1.1 simonb struct wpi_dma_info desc_dma;
71 1.1 simonb struct wpi_dma_info cmd_dma;
72 1.1 simonb struct wpi_tx_desc *desc;
73 1.1 simonb struct wpi_tx_cmd *cmd;
74 1.1 simonb struct wpi_tx_data *data;
75 1.1 simonb int qid;
76 1.1 simonb int count;
77 1.1 simonb int queued;
78 1.1 simonb int cur;
79 1.1 simonb };
80 1.1 simonb
81 1.1 simonb struct wpi_rx_data {
82 1.1 simonb bus_dmamap_t map;
83 1.1 simonb struct mbuf *m;
84 1.1 simonb };
85 1.1 simonb
86 1.1 simonb struct wpi_rx_ring {
87 1.1 simonb struct wpi_dma_info desc_dma;
88 1.1 simonb uint32_t *desc;
89 1.1 simonb struct wpi_rx_data data[WPI_RX_RING_COUNT];
90 1.1 simonb int cur;
91 1.1 simonb };
92 1.1 simonb
93 1.2 joerg struct wpi_node {
94 1.1 simonb struct ieee80211_node ni; /* must be the first */
95 1.2 joerg struct ieee80211_amrr_node amn;
96 1.1 simonb };
97 1.1 simonb
98 1.1 simonb struct wpi_softc {
99 1.1 simonb struct device sc_dev;
100 1.1 simonb struct ethercom sc_ec;
101 1.1 simonb struct ieee80211com sc_ic;
102 1.1 simonb int (*sc_newstate)(struct ieee80211com *,
103 1.1 simonb enum ieee80211_state, int);
104 1.2 joerg struct ieee80211_amrr amrr;
105 1.1 simonb
106 1.1 simonb uint32_t flags;
107 1.1 simonb #define WPI_FLAG_FW_INITED (1 << 0)
108 1.1 simonb
109 1.1 simonb bus_dma_tag_t sc_dmat;
110 1.1 simonb
111 1.1 simonb /* shared area */
112 1.1 simonb struct wpi_dma_info shared_dma;
113 1.1 simonb struct wpi_shared *shared;
114 1.1 simonb
115 1.1 simonb struct wpi_tx_ring txq[4];
116 1.1 simonb struct wpi_tx_ring cmdq;
117 1.1 simonb struct wpi_tx_ring svcq;
118 1.1 simonb struct wpi_rx_ring rxq;
119 1.1 simonb
120 1.1 simonb bus_space_tag_t sc_st;
121 1.1 simonb bus_space_handle_t sc_sh;
122 1.1 simonb void *sc_ih;
123 1.1 simonb pci_chipset_tag_t sc_pct;
124 1.1 simonb pcitag_t sc_pcitag;
125 1.1 simonb bus_size_t sc_sz;
126 1.1 simonb
127 1.1 simonb struct callout amrr_ch;
128 1.1 simonb
129 1.1 simonb struct wpi_config config;
130 1.1 simonb uint16_t pwr1[14];
131 1.1 simonb uint16_t pwr2[14];
132 1.1 simonb
133 1.1 simonb int sc_tx_timer;
134 1.1 simonb void *powerhook;
135 1.1 simonb
136 1.1 simonb #if NBPFILTER > 0
137 1.1 simonb caddr_t sc_drvbpf;
138 1.1 simonb
139 1.1 simonb union {
140 1.1 simonb struct wpi_rx_radiotap_header th;
141 1.1 simonb uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
142 1.1 simonb } sc_rxtapu;
143 1.1 simonb #define sc_rxtap sc_rxtapu.th
144 1.1 simonb int sc_rxtap_len;
145 1.1 simonb
146 1.1 simonb union {
147 1.1 simonb struct wpi_tx_radiotap_header th;
148 1.1 simonb uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
149 1.1 simonb } sc_txtapu;
150 1.1 simonb #define sc_txtap sc_txtapu.th
151 1.1 simonb int sc_txtap_len;
152 1.1 simonb #endif
153 1.1 simonb };
154