Commit | Line | Data |
---|---|---|
5b435de0 AS |
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 | ||
17 | #ifndef _BRCM_MAC80211_IF_H_ | |
18 | #define _BRCM_MAC80211_IF_H_ | |
19 | ||
20 | #include <linux/timer.h> | |
21 | #include <linux/interrupt.h> | |
22 | #include "ucode_loader.h" | |
23 | /* | |
24 | * Starting index for 5G rates in the | |
25 | * legacy rate table. | |
26 | */ | |
27 | #define BRCMS_LEGACY_5G_RATE_OFFSET 4 | |
28 | ||
29 | /* softmac ioctl definitions */ | |
30 | #define BRCMS_SET_SHORTSLOT_OVERRIDE 146 | |
31 | ||
32 | struct brcms_timer { | |
33 | struct timer_list timer; | |
34 | struct brcms_info *wl; | |
35 | void (*fn) (void *); | |
36 | void *arg; /* argument to fn */ | |
37 | uint ms; | |
38 | bool periodic; | |
39 | bool set; | |
40 | struct brcms_timer *next; | |
41 | #ifdef BCMDBG | |
42 | char *name; /* Description of the timer */ | |
43 | #endif | |
44 | }; | |
45 | ||
46 | struct brcms_if { | |
47 | uint subunit; /* WDS/BSS unit */ | |
48 | struct pci_dev *pci_dev; | |
49 | }; | |
50 | ||
51 | #define MAX_FW_IMAGES 4 | |
52 | struct brcms_firmware { | |
53 | u32 fw_cnt; | |
54 | const struct firmware *fw_bin[MAX_FW_IMAGES]; | |
55 | const struct firmware *fw_hdr[MAX_FW_IMAGES]; | |
56 | u32 hdr_num_entries[MAX_FW_IMAGES]; | |
57 | }; | |
58 | ||
59 | struct brcms_info { | |
60 | struct brcms_pub *pub; /* pointer to public wlc state */ | |
61 | struct brcms_c_info *wlc; /* pointer to private common data */ | |
62 | u32 magic; | |
63 | ||
64 | int irq; | |
65 | ||
66 | spinlock_t lock; /* per-device perimeter lock */ | |
67 | spinlock_t isr_lock; /* per-device ISR synchronization lock */ | |
68 | ||
69 | /* regsva for unmap in brcms_free() */ | |
70 | void __iomem *regsva; /* opaque chip registers virtual address */ | |
71 | ||
72 | /* timer related fields */ | |
73 | atomic_t callbacks; /* # outstanding callback functions */ | |
74 | struct brcms_timer *timers; /* timer cleanup queue */ | |
75 | ||
76 | struct tasklet_struct tasklet; /* dpc tasklet */ | |
77 | bool resched; /* dpc needs to be and is rescheduled */ | |
78 | struct brcms_firmware fw; | |
79 | struct wiphy *wiphy; | |
80 | struct brcms_ucode ucode; | |
81 | }; | |
82 | ||
83 | /* misc callbacks */ | |
84 | extern void brcms_init(struct brcms_info *wl); | |
85 | extern uint brcms_reset(struct brcms_info *wl); | |
86 | extern void brcms_intrson(struct brcms_info *wl); | |
87 | extern u32 brcms_intrsoff(struct brcms_info *wl); | |
88 | extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask); | |
89 | extern int brcms_up(struct brcms_info *wl); | |
90 | extern void brcms_down(struct brcms_info *wl); | |
91 | extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, | |
92 | bool state, int prio); | |
93 | extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl); | |
94 | ||
95 | /* timer functions */ | |
96 | extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl, | |
97 | void (*fn) (void *arg), void *arg, | |
98 | const char *name); | |
99 | extern void brcms_free_timer(struct brcms_info *wl, struct brcms_timer *timer); | |
100 | extern void brcms_add_timer(struct brcms_info *wl, struct brcms_timer *timer, | |
101 | uint ms, int periodic); | |
102 | extern bool brcms_del_timer(struct brcms_info *wl, struct brcms_timer *timer); | |
103 | extern void brcms_msleep(struct brcms_info *wl, uint ms); | |
104 | extern void brcms_dpc(unsigned long data); | |
105 | extern void brcms_timer(struct brcms_timer *t); | |
106 | ||
107 | #endif /* _BRCM_MAC80211_IF_H_ */ |