Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmfmac / dhd_bus.h
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 _dhd_bus_h_
18 #define _dhd_bus_h_
19
20 /*
21  * Exported from dhd bus module (dhd_usb, dhd_sdio)
22  */
23
24 /* Indicate (dis)interest in finding dongles. */
25 extern int dhd_bus_register(void);
26 extern void dhd_bus_unregister(void);
27
28 /* Download firmware image and nvram image */
29 extern bool dhd_bus_download_firmware(struct dhd_bus *bus, osl_t * osh,
30                                       char *fw_path, char *nv_path);
31
32 /* Stop bus module: clear pending frames, disable data flow */
33 extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex);
34
35 /* Initialize bus module: prepare for communication w/dongle */
36 extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex);
37
38 /* Send a data frame to the dongle.  Callee disposes of txp. */
39 extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp);
40
41 /* Send/receive a control message to/from the dongle.
42  * Expects caller to enforce a single outstanding transaction.
43  */
44 extern int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);
45 extern int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);
46
47 /* Watchdog timer function */
48 extern bool dhd_bus_watchdog(dhd_pub_t *dhd);
49
50 #ifdef DHD_DEBUG
51 /* Device console input function */
52 extern int dhd_bus_console_in(dhd_pub_t *dhd, unsigned char *msg, uint msglen);
53 #endif                          /* DHD_DEBUG */
54
55 /* Deferred processing for the bus, return true requests reschedule */
56 extern bool dhd_bus_dpc(struct dhd_bus *bus);
57 extern void dhd_bus_isr(bool *InterruptRecognized,
58                         bool *QueueMiniportHandleInterrupt, void *arg);
59
60 /* Check for and handle local prot-specific iovar commands */
61 extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,
62                             void *params, int plen, void *arg, int len,
63                             bool set);
64
65 /* Add bus dump output to a buffer */
66 extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
67
68 /* Clear any bus counters */
69 extern void dhd_bus_clearcounts(dhd_pub_t *dhdp);
70
71 /* return the dongle chipid */
72 extern uint dhd_bus_chip(struct dhd_bus *bus);
73
74 /* Set user-specified nvram parameters. */
75 extern void dhd_bus_set_nvram_params(struct dhd_bus *bus,
76                                      const char *nvram_params);
77
78 extern void *dhd_bus_pub(struct dhd_bus *bus);
79 extern void *dhd_bus_txq(struct dhd_bus *bus);
80 extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
81
82 #endif                          /* _dhd_bus_h_ */