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