6 #include <linux/interrupt.h>
8 #include <linux/list.h>
9 #include <linux/skbuff.h>
11 #define B43_PIO_TXCTL 0x00
12 #define B43_PIO_TXDATA 0x02
13 #define B43_PIO_TXQBUFSIZE 0x04
14 #define B43_PIO_RXCTL 0x08
15 #define B43_PIO_RXDATA 0x0A
17 #define B43_PIO_TXCTL_WRITELO (1 << 0)
18 #define B43_PIO_TXCTL_WRITEHI (1 << 1)
19 #define B43_PIO_TXCTL_COMPLETE (1 << 2)
20 #define B43_PIO_TXCTL_INIT (1 << 3)
21 #define B43_PIO_TXCTL_SUSPEND (1 << 7)
23 #define B43_PIO_RXCTL_DATAAVAILABLE (1 << 0)
24 #define B43_PIO_RXCTL_READY (1 << 1)
27 #define B43_PIO_MAXTXDEVQPACKETS 31
28 #define B43_PIO_TXQADJUST 80
30 /* PIO tuning knobs */
31 #define B43_PIO_MAXTXPACKETS 256
36 struct b43_xmitstatus
;
38 struct b43_pio_txpacket
{
39 struct b43_pioqueue
*queue
;
41 struct ieee80211_tx_status txstat
;
42 struct list_head list
;
43 u16 index
; /* Index in the tx_packets_cache */
47 struct b43_wldev
*dev
;
52 bool need_workarounds
; /* Workarounds needed for core.rev < 3 */
54 /* Adjusted size of the device internal TX buffer. */
56 /* Used octets of the device internal TX buffer. */
58 /* Used packet slots in the device internal TX buffer. */
60 /* Packets from the txfree list can
61 * be taken on incoming TX requests.
63 struct list_head txfree
;
64 unsigned int nr_txfree
;
65 /* Packets on the txqueue are queued,
66 * but not completely written to the chip, yet.
68 struct list_head txqueue
;
69 /* Packets on the txrunning queue are completely
70 * posted to the device. We are waiting for the txstatus.
72 struct list_head txrunning
;
73 /* Total number or packets sent.
74 * (This counter can obviously wrap).
76 unsigned int nr_tx_packets
;
77 struct tasklet_struct txtask
;
78 struct b43_pio_txpacket tx_packets_cache
[B43_PIO_MAXTXPACKETS
];
81 static inline u16
b43_pio_read(struct b43_pioqueue
*queue
, u16 offset
)
83 return b43_read16(queue
->dev
, queue
->mmio_base
+ offset
);
87 void b43_pio_write(struct b43_pioqueue
*queue
, u16 offset
, u16 value
)
89 b43_write16(queue
->dev
, queue
->mmio_base
+ offset
, value
);
93 int b43_pio_init(struct b43_wldev
*dev
);
94 void b43_pio_free(struct b43_wldev
*dev
);
96 int b43_pio_tx(struct b43_wldev
*dev
,
97 struct sk_buff
*skb
, struct ieee80211_tx_control
*ctl
);
98 void b43_pio_handle_txstatus(struct b43_wldev
*dev
,
99 const struct b43_txstatus
*status
);
100 void b43_pio_get_tx_stats(struct b43_wldev
*dev
,
101 struct ieee80211_tx_queue_stats
*stats
);
102 void b43_pio_rx(struct b43_pioqueue
*queue
);
104 /* Suspend TX queue in hardware. */
105 void b43_pio_tx_suspend(struct b43_pioqueue
*queue
);
106 void b43_pio_tx_resume(struct b43_pioqueue
*queue
);
107 /* Suspend (freeze) the TX tasklet (software level). */
108 void b43_pio_freeze_txqueues(struct b43_wldev
*dev
);
109 void b43_pio_thaw_txqueues(struct b43_wldev
*dev
);
111 #else /* CONFIG_B43_PIO */
113 static inline int b43_pio_init(struct b43_wldev
*dev
)
117 static inline void b43_pio_free(struct b43_wldev
*dev
)
121 int b43_pio_tx(struct b43_wldev
*dev
,
122 struct sk_buff
*skb
, struct ieee80211_tx_control
*ctl
)
127 void b43_pio_handle_txstatus(struct b43_wldev
*dev
,
128 const struct b43_txstatus
*status
)
132 void b43_pio_get_tx_stats(struct b43_wldev
*dev
,
133 struct ieee80211_tx_queue_stats
*stats
)
136 static inline void b43_pio_rx(struct b43_pioqueue
*queue
)
139 static inline void b43_pio_tx_suspend(struct b43_pioqueue
*queue
)
142 static inline void b43_pio_tx_resume(struct b43_pioqueue
*queue
)
145 static inline void b43_pio_freeze_txqueues(struct b43_wldev
*dev
)
148 static inline void b43_pio_thaw_txqueues(struct b43_wldev
*dev
)
152 #endif /* CONFIG_B43_PIO */
153 #endif /* B43_PIO_H_ */