bcm43xx_pio.h 2.4 KB

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