John W. Linville | f222313 | 2006-01-23 16:59:58 -0500 | [diff] [blame^] | 1 | #ifndef BCM43xx_PIO_H_ |
| 2 | #define BCM43xx_PIO_H_ |
| 3 | |
| 4 | #include "bcm43xx.h" |
| 5 | |
| 6 | #include <linux/list.h> |
| 7 | #include <linux/spinlock.h> |
| 8 | #include <linux/workqueue.h> |
| 9 | #include <linux/skbuff.h> |
| 10 | |
| 11 | |
| 12 | #define BCM43xx_PIO_TXCTL 0x00 |
| 13 | #define BCM43xx_PIO_TXDATA 0x02 |
| 14 | #define BCM43xx_PIO_TXQBUFSIZE 0x04 |
| 15 | #define BCM43xx_PIO_RXCTL 0x08 |
| 16 | #define BCM43xx_PIO_RXDATA 0x0A |
| 17 | |
| 18 | #define BCM43xx_PIO_TXCTL_WRITEHI (1 << 0) |
| 19 | #define BCM43xx_PIO_TXCTL_WRITELO (1 << 1) |
| 20 | #define BCM43xx_PIO_TXCTL_COMPLETE (1 << 2) |
| 21 | #define BCM43xx_PIO_TXCTL_INIT (1 << 3) |
| 22 | #define BCM43xx_PIO_TXCTL_SUSPEND (1 << 7) |
| 23 | |
| 24 | #define BCM43xx_PIO_RXCTL_DATAAVAILABLE (1 << 0) |
| 25 | #define BCM43xx_PIO_RXCTL_READY (1 << 1) |
| 26 | |
| 27 | /* PIO constants */ |
| 28 | #define BCM43xx_PIO_MAXTXDEVQPACKETS 31 |
| 29 | #define BCM43xx_PIO_TXQADJUST 80 |
| 30 | |
| 31 | /* PIO tuning knobs */ |
| 32 | #define BCM43xx_PIO_MAXTXPACKETS 256 |
| 33 | |
| 34 | |
| 35 | struct bcm43xx_pioqueue; |
| 36 | struct bcm43xx_xmitstatus; |
| 37 | |
| 38 | struct bcm43xx_pio_txpacket { |
| 39 | struct bcm43xx_pioqueue *queue; |
| 40 | struct ieee80211_txb *txb; |
| 41 | struct list_head list; |
| 42 | |
| 43 | u8 xmitted_frags; |
| 44 | u16 xmitted_octets; |
| 45 | }; |
| 46 | |
| 47 | #define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->__tx_packets_cache)) |
| 48 | |
| 49 | struct bcm43xx_pioqueue { |
| 50 | struct bcm43xx_private *bcm; |
| 51 | u16 mmio_base; |
| 52 | |
| 53 | u8 tx_suspended:1; |
| 54 | |
| 55 | /* Adjusted size of the device internal TX buffer. */ |
| 56 | u16 tx_devq_size; |
| 57 | /* Used octets of the device internal TX buffer. */ |
| 58 | u16 tx_devq_used; |
| 59 | /* Used packet slots in the device internal TX buffer. */ |
| 60 | u8 tx_devq_packets; |
| 61 | /* Packets from the txfree list can |
| 62 | * be taken on incoming TX requests. |
| 63 | */ |
| 64 | struct list_head txfree; |
| 65 | /* Packets on the txqueue are queued, |
| 66 | * but not completely written to the chip, yet. |
| 67 | */ |
| 68 | struct list_head txqueue; |
| 69 | /* Packets on the txrunning queue are completely |
| 70 | * posted to the device. We are waiting for the txstatus. |
| 71 | */ |
| 72 | struct list_head txrunning; |
| 73 | /* Locking of the TX queues and the accounting. */ |
| 74 | spinlock_t txlock; |
| 75 | struct work_struct txwork; |
| 76 | struct bcm43xx_pio_txpacket __tx_packets_cache[BCM43xx_PIO_MAXTXPACKETS]; |
| 77 | }; |
| 78 | |
| 79 | int bcm43xx_pio_init(struct bcm43xx_private *bcm); |
| 80 | void bcm43xx_pio_free(struct bcm43xx_private *bcm); |
| 81 | |
| 82 | int FASTCALL(bcm43xx_pio_transfer_txb(struct bcm43xx_private *bcm, |
| 83 | struct ieee80211_txb *txb)); |
| 84 | void FASTCALL(bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm, |
| 85 | struct bcm43xx_xmitstatus *status)); |
| 86 | |
| 87 | void FASTCALL(bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue)); |
| 88 | #endif /* BCM43xx_PIO_H_ */ |