• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * OS Abstraction Layer
3  *
4  * Copyright (C) 1999-2013, Broadcom Corporation
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions of
16  * the license of that module.  An independent module is a module which is not
17  * derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  * $Id: osl.h 370064 2012-11-20 21:00:25Z $
25  */
26 
27 #ifndef _osl_h_
28 #define _osl_h_
29 
30 /* osl handle type forward declaration */
31 typedef struct osl_info osl_t;
32 typedef struct osl_dmainfo osldma_t;
33 
34 #define OSL_PKTTAG_SZ	32 /* Size of PktTag */
35 
36 /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */
37 typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status);
38 
39 /* Drivers use REGOPSSET() to register register read/write funcitons */
40 typedef unsigned int (*osl_rreg_fn_t)(void *ctx, volatile void *reg, unsigned int size);
41 typedef void  (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val, unsigned int size);
42 
43 
44 #include <linux_osl.h>
45 
46 #ifndef PKTDBG_TRACE
47 #define PKTDBG_TRACE(osh, pkt, bit)
48 #endif
49 
50 #define PKTCTFMAP(osh, p)
51 
52 /* --------------------------------------------------------------------------
53 ** Register manipulation macros.
54 */
55 
56 #define	SET_REG(osh, r, mask, val)	W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
57 
58 #ifndef AND_REG
59 #define AND_REG(osh, r, v)		W_REG(osh, (r), R_REG(osh, r) & (v))
60 #endif   /* !AND_REG */
61 
62 #ifndef OR_REG
63 #define OR_REG(osh, r, v)		W_REG(osh, (r), R_REG(osh, r) | (v))
64 #endif   /* !OR_REG */
65 
66 #if !defined(OSL_SYSUPTIME)
67 #define OSL_SYSUPTIME() (0)
68 #define OSL_SYSUPTIME_SUPPORT FALSE
69 #else
70 #define OSL_SYSUPTIME_SUPPORT TRUE
71 #endif /* OSL_SYSUPTIME */
72 
73 #if !defined(PKTC)
74 #define	PKTCGETATTR(s)		(0)
75 #define	PKTCSETATTR(skb, f, p, b)
76 #define	PKTCCLRATTR(skb)
77 #define	PKTCCNT(skb)		(1)
78 #define	PKTCLEN(skb)		PKTLEN(NULL, skb)
79 #define	PKTCGETFLAGS(skb)	(0)
80 #define	PKTCSETFLAGS(skb, f)
81 #define	PKTCCLRFLAGS(skb)
82 #define	PKTCFLAGS(skb)		(0)
83 #define	PKTCSETCNT(skb, c)
84 #define	PKTCINCRCNT(skb)
85 #define	PKTCADDCNT(skb, c)
86 #define	PKTCSETLEN(skb, l)
87 #define	PKTCADDLEN(skb, l)
88 #define	PKTCSETFLAG(skb, fb)
89 #define	PKTCCLRFLAG(skb, fb)
90 #define	PKTCLINK(skb)		NULL
91 #define	PKTSETCLINK(skb, x)
92 #define FOREACH_CHAINED_PKT(skb, nskb) \
93 	for ((nskb) = NULL; (skb) != NULL; (skb) = (nskb))
94 #define	PKTCFREE		PKTFREE
95 #endif /* !linux || !PKTC */
96 
97 #ifndef HNDCTF
98 #define PKTSETCHAINED(osh, skb)
99 #define PKTCLRCHAINED(osh, skb)
100 #define PKTISCHAINED(skb)	(FALSE)
101 #endif
102 
103 #endif	/* _osl_h_ */
104