Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2010 Broadcom Corporation
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
0011  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
0013  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
0014  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef _BRCM_MAC80211_IF_H_
0018 #define _BRCM_MAC80211_IF_H_
0019 
0020 #include <linux/timer.h>
0021 #include <linux/interrupt.h>
0022 #include <linux/workqueue.h>
0023 #include <linux/leds.h>
0024 
0025 #include "ucode_loader.h"
0026 #include "led.h"
0027 /*
0028  * Starting index for 5G rates in the
0029  * legacy rate table.
0030  */
0031 #define BRCMS_LEGACY_5G_RATE_OFFSET 4
0032 
0033 /* softmac ioctl definitions */
0034 #define BRCMS_SET_SHORTSLOT_OVERRIDE        146
0035 
0036 struct brcms_timer {
0037     struct delayed_work dly_wrk;
0038     struct brcms_info *wl;
0039     void (*fn) (void *);    /* function called upon expiration */
0040     void *arg;      /* fixed argument provided to called function */
0041     uint ms;
0042     bool periodic;
0043     bool set;       /* indicates if timer is active */
0044     struct brcms_timer *next;   /* for freeing on unload */
0045 #ifdef DEBUG
0046     char *name;     /* Description of the timer */
0047 #endif
0048 };
0049 
0050 struct brcms_if {
0051     uint subunit;       /* WDS/BSS unit */
0052     struct pci_dev *pci_dev;
0053 };
0054 
0055 #define MAX_FW_IMAGES       4
0056 struct brcms_firmware {
0057     u32 fw_cnt;
0058     const struct firmware *fw_bin[MAX_FW_IMAGES];
0059     const struct firmware *fw_hdr[MAX_FW_IMAGES];
0060     u32 hdr_num_entries[MAX_FW_IMAGES];
0061 };
0062 
0063 struct brcms_info {
0064     struct brcms_pub *pub;      /* pointer to public wlc state */
0065     struct brcms_c_info *wlc;   /* pointer to private common data */
0066     u32 magic;
0067 
0068     int irq;
0069 
0070     spinlock_t lock;    /* per-device perimeter lock */
0071     spinlock_t isr_lock;    /* per-device ISR synchronization lock */
0072 
0073     /* tx flush */
0074     wait_queue_head_t tx_flush_wq;
0075 
0076     /* timer related fields */
0077     atomic_t callbacks; /* # outstanding callback functions */
0078     struct brcms_timer *timers; /* timer cleanup queue */
0079 
0080     struct tasklet_struct tasklet;  /* dpc tasklet */
0081     bool resched;       /* dpc needs to be and is rescheduled */
0082     struct brcms_firmware fw;
0083     struct wiphy *wiphy;
0084     struct brcms_ucode ucode;
0085     bool mute_tx;
0086     struct brcms_led radio_led;
0087     struct led_classdev led_dev;
0088 };
0089 
0090 /* misc callbacks */
0091 void brcms_init(struct brcms_info *wl);
0092 uint brcms_reset(struct brcms_info *wl);
0093 void brcms_intrson(struct brcms_info *wl);
0094 u32 brcms_intrsoff(struct brcms_info *wl);
0095 void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask);
0096 int brcms_up(struct brcms_info *wl);
0097 void brcms_down(struct brcms_info *wl);
0098 void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
0099              bool state, int prio);
0100 bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
0101 
0102 /* timer functions */
0103 struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
0104                      void (*fn) (void *arg), void *arg,
0105                      const char *name);
0106 void brcms_free_timer(struct brcms_timer *timer);
0107 void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
0108 bool brcms_del_timer(struct brcms_timer *timer);
0109 void brcms_dpc(struct tasklet_struct *t);
0110 void brcms_timer(struct brcms_timer *t);
0111 void brcms_fatal_error(struct brcms_info *wl);
0112 
0113 #endif              /* _BRCM_MAC80211_IF_H_ */