mac80211_if.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 "ucode_loader.h"
  22. /*
  23. * Starting index for 5G rates in the
  24. * legacy rate table.
  25. */
  26. #define BRCMS_LEGACY_5G_RATE_OFFSET 4
  27. /* softmac ioctl definitions */
  28. #define BRCMS_SET_SHORTSLOT_OVERRIDE 146
  29. struct brcms_timer {
  30. struct delayed_work dly_wrk;
  31. struct brcms_info *wl;
  32. void (*fn) (void *); /* function called upon expiration */
  33. void *arg; /* fixed argument provided to called function */
  34. uint ms;
  35. bool periodic;
  36. bool set; /* indicates if timer is active */
  37. struct brcms_timer *next; /* for freeing on unload */
  38. #ifdef DEBUG
  39. char *name; /* Description of the timer */
  40. #endif
  41. };
  42. struct brcms_if {
  43. uint subunit; /* WDS/BSS unit */
  44. struct pci_dev *pci_dev;
  45. };
  46. #define MAX_FW_IMAGES 4
  47. struct brcms_firmware {
  48. u32 fw_cnt;
  49. const struct firmware *fw_bin[MAX_FW_IMAGES];
  50. const struct firmware *fw_hdr[MAX_FW_IMAGES];
  51. u32 hdr_num_entries[MAX_FW_IMAGES];
  52. };
  53. struct brcms_info {
  54. struct brcms_pub *pub; /* pointer to public wlc state */
  55. struct brcms_c_info *wlc; /* pointer to private common data */
  56. u32 magic;
  57. int irq;
  58. spinlock_t lock; /* per-device perimeter lock */
  59. spinlock_t isr_lock; /* per-device ISR synchronization lock */
  60. /* timer related fields */
  61. atomic_t callbacks; /* # outstanding callback functions */
  62. struct brcms_timer *timers; /* timer cleanup queue */
  63. struct tasklet_struct tasklet; /* dpc tasklet */
  64. bool resched; /* dpc needs to be and is rescheduled */
  65. struct brcms_firmware fw;
  66. struct wiphy *wiphy;
  67. struct brcms_ucode ucode;
  68. bool mute_tx;
  69. };
  70. /* misc callbacks */
  71. extern void brcms_init(struct brcms_info *wl);
  72. extern uint brcms_reset(struct brcms_info *wl);
  73. extern void brcms_intrson(struct brcms_info *wl);
  74. extern u32 brcms_intrsoff(struct brcms_info *wl);
  75. extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
  76. extern int brcms_up(struct brcms_info *wl);
  77. extern void brcms_down(struct brcms_info *wl);
  78. extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
  79. bool state, int prio);
  80. extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
  81. /* timer functions */
  82. extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
  83. void (*fn) (void *arg), void *arg,
  84. const char *name);
  85. extern void brcms_free_timer(struct brcms_timer *timer);
  86. extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
  87. extern bool brcms_del_timer(struct brcms_timer *timer);
  88. extern void brcms_msleep(struct brcms_info *wl, uint ms);
  89. extern void brcms_dpc(unsigned long data);
  90. extern void brcms_timer(struct brcms_timer *t);
  91. extern void brcms_fatal_error(struct brcms_info *wl);
  92. #endif /* _BRCM_MAC80211_IF_H_ */