mac80211_if.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _BRCM_MAC80211_IF_H_
  17. #define _BRCM_MAC80211_IF_H_
  18. #include <linux/timer.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/workqueue.h>
  21. #include <linux/leds.h>
  22. #include "ucode_loader.h"
  23. #include "led.h"
  24. /*
  25. * Starting index for 5G rates in the
  26. * legacy rate table.
  27. */
  28. #define BRCMS_LEGACY_5G_RATE_OFFSET 4
  29. /* softmac ioctl definitions */
  30. #define BRCMS_SET_SHORTSLOT_OVERRIDE 146
  31. struct brcms_timer {
  32. struct delayed_work dly_wrk;
  33. struct brcms_info *wl;
  34. void (*fn) (void *); /* function called upon expiration */
  35. void *arg; /* fixed argument provided to called function */
  36. uint ms;
  37. bool periodic;
  38. bool set; /* indicates if timer is active */
  39. struct brcms_timer *next; /* for freeing on unload */
  40. #ifdef DEBUG
  41. char *name; /* Description of the timer */
  42. #endif
  43. };
  44. struct brcms_if {
  45. uint subunit; /* WDS/BSS unit */
  46. struct pci_dev *pci_dev;
  47. };
  48. #define MAX_FW_IMAGES 4
  49. struct brcms_firmware {
  50. u32 fw_cnt;
  51. const struct firmware *fw_bin[MAX_FW_IMAGES];
  52. const struct firmware *fw_hdr[MAX_FW_IMAGES];
  53. u32 hdr_num_entries[MAX_FW_IMAGES];
  54. };
  55. struct brcms_info {
  56. struct brcms_pub *pub; /* pointer to public wlc state */
  57. struct brcms_c_info *wlc; /* pointer to private common data */
  58. u32 magic;
  59. int irq;
  60. spinlock_t lock; /* per-device perimeter lock */
  61. spinlock_t isr_lock; /* per-device ISR synchronization lock */
  62. /* tx flush */
  63. wait_queue_head_t tx_flush_wq;
  64. /* timer related fields */
  65. atomic_t callbacks; /* # outstanding callback functions */
  66. struct brcms_timer *timers; /* timer cleanup queue */
  67. struct tasklet_struct tasklet; /* dpc tasklet */
  68. bool resched; /* dpc needs to be and is rescheduled */
  69. struct brcms_firmware fw;
  70. struct wiphy *wiphy;
  71. struct brcms_ucode ucode;
  72. bool mute_tx;
  73. struct brcms_led radio_led;
  74. struct led_classdev led_dev;
  75. };
  76. /* misc callbacks */
  77. void brcms_init(struct brcms_info *wl);
  78. uint brcms_reset(struct brcms_info *wl);
  79. void brcms_intrson(struct brcms_info *wl);
  80. u32 brcms_intrsoff(struct brcms_info *wl);
  81. void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
  82. int brcms_up(struct brcms_info *wl);
  83. void brcms_down(struct brcms_info *wl);
  84. void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
  85. bool state, int prio);
  86. bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
  87. /* timer functions */
  88. struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
  89. void (*fn) (void *arg), void *arg,
  90. const char *name);
  91. void brcms_free_timer(struct brcms_timer *timer);
  92. void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
  93. bool brcms_del_timer(struct brcms_timer *timer);
  94. void brcms_dpc(unsigned long data);
  95. void brcms_timer(struct brcms_timer *t);
  96. void brcms_fatal_error(struct brcms_info *wl);
  97. #endif /* _BRCM_MAC80211_IF_H_ */