Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[pandora-kernel.git] / drivers / staging / brcm80211 / include / osl.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 _osl_h_
18 #define _osl_h_
19
20 /* osl handle type forward declaration */
21 typedef struct osl_info osl_t;
22 typedef struct osl_dmainfo osldma_t;
23
24 #define OSL_PKTTAG_SZ   32      /* Size of PktTag */
25
26 /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */
27 typedef void (*pktfree_cb_fn_t) (void *ctx, void *pkt, unsigned int status);
28
29 #ifdef BCMSDIO
30 /* Drivers use REGOPSSET() to register register read/write funcitons */
31 typedef unsigned int (*osl_rreg_fn_t) (void *ctx, void *reg, unsigned int size);
32 typedef void (*osl_wreg_fn_t) (void *ctx, void *reg, unsigned int val,
33                                unsigned int size);
34 #endif
35
36 #include <linux_osl.h>
37
38 /* --------------------------------------------------------------------------
39 ** Register manipulation macros.
40 */
41
42 #define SET_REG(osh, r, mask, val)      W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
43
44 #ifndef AND_REG
45 #define AND_REG(osh, r, v)              W_REG(osh, (r), R_REG(osh, r) & (v))
46 #endif                          /* !AND_REG */
47
48 #ifndef OR_REG
49 #define OR_REG(osh, r, v)               W_REG(osh, (r), R_REG(osh, r) | (v))
50 #endif                          /* !OR_REG */
51
52 #if !defined(OSL_SYSUPTIME)
53 #define OSL_SYSUPTIME() (0)
54 #define OSL_SYSUPTIME_SUPPORT false
55 #else
56 #define OSL_SYSUPTIME_SUPPORT true
57 #endif                          /* OSL_SYSUPTIME */
58
59 #endif                          /* _osl_h_ */