[B43]: Fix sparse warnings.
[linux-2.6/btrfs-unstable.git] / drivers / net / wireless / b43 / pio.h
blob34a44c1b6314126f1929bb2feaf6acf912428de4
1 #ifndef B43_PIO_H_
2 #define B43_PIO_H_
4 #include "b43.h"
6 #include <linux/interrupt.h>
7 #include <linux/list.h>
8 #include <linux/skbuff.h>
10 #define B43_PIO_TXCTL 0x00
11 #define B43_PIO_TXDATA 0x02
12 #define B43_PIO_TXQBUFSIZE 0x04
13 #define B43_PIO_RXCTL 0x08
14 #define B43_PIO_RXDATA 0x0A
16 #define B43_PIO_TXCTL_WRITELO (1 << 0)
17 #define B43_PIO_TXCTL_WRITEHI (1 << 1)
18 #define B43_PIO_TXCTL_COMPLETE (1 << 2)
19 #define B43_PIO_TXCTL_INIT (1 << 3)
20 #define B43_PIO_TXCTL_SUSPEND (1 << 7)
22 #define B43_PIO_RXCTL_DATAAVAILABLE (1 << 0)
23 #define B43_PIO_RXCTL_READY (1 << 1)
25 /* PIO constants */
26 #define B43_PIO_MAXTXDEVQPACKETS 31
27 #define B43_PIO_TXQADJUST 80
29 /* PIO tuning knobs */
30 #define B43_PIO_MAXTXPACKETS 256
32 #ifdef CONFIG_B43_PIO
34 struct b43_pioqueue;
35 struct b43_xmitstatus;
37 struct b43_pio_txpacket {
38 struct b43_pioqueue *queue;
39 struct sk_buff *skb;
40 struct ieee80211_tx_status txstat;
41 struct list_head list;
42 u16 index; /* Index in the tx_packets_cache */
45 struct b43_pioqueue {
46 struct b43_wldev *dev;
47 u16 mmio_base;
49 bool tx_suspended;
50 bool tx_frozen;
51 bool need_workarounds; /* Workarounds needed for core.rev < 3 */
53 /* Adjusted size of the device internal TX buffer. */
54 u16 tx_devq_size;
55 /* Used octets of the device internal TX buffer. */
56 u16 tx_devq_used;
57 /* Used packet slots in the device internal TX buffer. */
58 u8 tx_devq_packets;
59 /* Packets from the txfree list can
60 * be taken on incoming TX requests.
62 struct list_head txfree;
63 unsigned int nr_txfree;
64 /* Packets on the txqueue are queued,
65 * but not completely written to the chip, yet.
67 struct list_head txqueue;
68 /* Packets on the txrunning queue are completely
69 * posted to the device. We are waiting for the txstatus.
71 struct list_head txrunning;
72 /* Total number or packets sent.
73 * (This counter can obviously wrap).
75 unsigned int nr_tx_packets;
76 struct tasklet_struct txtask;
77 struct b43_pio_txpacket tx_packets_cache[B43_PIO_MAXTXPACKETS];
80 static inline u16 b43_pio_read(struct b43_pioqueue *queue, u16 offset)
82 return b43_read16(queue->dev, queue->mmio_base + offset);
85 static inline
86 void b43_pio_write(struct b43_pioqueue *queue, u16 offset, u16 value)
88 b43_write16(queue->dev, queue->mmio_base + offset, value);
89 mmiowb();
92 int b43_pio_init(struct b43_wldev *dev);
93 void b43_pio_free(struct b43_wldev *dev);
95 int b43_pio_tx(struct b43_wldev *dev,
96 struct sk_buff *skb, struct ieee80211_tx_control *ctl);
97 void b43_pio_handle_txstatus(struct b43_wldev *dev,
98 const struct b43_txstatus *status);
99 void b43_pio_get_tx_stats(struct b43_wldev *dev,
100 struct ieee80211_tx_queue_stats *stats);
101 void b43_pio_rx(struct b43_pioqueue *queue);
103 /* Suspend TX queue in hardware. */
104 void b43_pio_tx_suspend(struct b43_pioqueue *queue);
105 void b43_pio_tx_resume(struct b43_pioqueue *queue);
106 /* Suspend (freeze) the TX tasklet (software level). */
107 void b43_pio_freeze_txqueues(struct b43_wldev *dev);
108 void b43_pio_thaw_txqueues(struct b43_wldev *dev);
110 #else /* CONFIG_B43_PIO */
112 static inline int b43_pio_init(struct b43_wldev *dev)
114 return 0;
116 static inline void b43_pio_free(struct b43_wldev *dev)
119 static inline
120 int b43_pio_tx(struct b43_wldev *dev,
121 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
123 return 0;
125 static inline
126 void b43_pio_handle_txstatus(struct b43_wldev *dev,
127 const struct b43_txstatus *status)
130 static inline
131 void b43_pio_get_tx_stats(struct b43_wldev *dev,
132 struct ieee80211_tx_queue_stats *stats)
135 static inline void b43_pio_rx(struct b43_pioqueue *queue)
138 static inline void b43_pio_tx_suspend(struct b43_pioqueue *queue)
141 static inline void b43_pio_tx_resume(struct b43_pioqueue *queue)
144 static inline void b43_pio_freeze_txqueues(struct b43_wldev *dev)
147 static inline void b43_pio_thaw_txqueues(struct b43_wldev *dev)
151 #endif /* CONFIG_B43_PIO */
152 #endif /* B43_PIO_H_ */