xref: /dragonfly/tools/tools/ath/common/ah_osdep.h (revision 7d3e9a5b)
1 /*-
2  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer,
10  *    without modification.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13  *    redistribution must be conditioned upon including a substantially
14  *    similar Disclaimer requirement for further binary redistribution.
15  *
16  * NO WARRANTY
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY
20  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27  * THE POSSIBILITY OF SUCH DAMAGES.
28  *
29  * $FreeBSD: src/tools/tools/ath/common/ah_osdep.h,v 1.1 2008/12/07 19:17:33 sam Exp $
30  */
31 #ifndef _ATH_AH_OSDEP_H_
32 #define _ATH_AH_OSDEP_H_
33 /*
34  * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
35  */
36 #include <sys/param.h>
37 
38 /*
39  * Bus i/o type definitions.
40  */
41 typedef void *HAL_SOFTC;
42 typedef int HAL_BUS_TAG;
43 typedef void *HAL_BUS_HANDLE;
44 
45 #define	OS_DELAY(_n)	DELAY(_n)
46 #define	OS_INLINE	__inline
47 #define	OS_MEMZERO(_a, _size)		bzero((_a), (_size))
48 #define	OS_MEMCPY(_dst, _src, _size)	bcopy((_src), (_dst), (_size))
49 #define	OS_MACEQU(_a, _b) \
50 	(bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
51 
52 struct ath_hal;
53 extern 	u_int32_t OS_GETUPTIME(struct ath_hal *);
54 extern	void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t);
55 extern	u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t);
56 extern	void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
57 #define	OS_GETUPTIME(_ah)	0
58 #define	OS_REG_WRITE(_ah, _reg, _val)
59 #define	OS_REG_READ(_ah, _reg)	0
60 #define	OS_MARK(_ah, _id, _v)
61 #define __packed __attribute__((__packed__))
62 
63 /*
64  * Linux/BSD gcc compatibility shims.
65  */
66 #ifndef __printflike
67 #define	__printflike(_a,_b) \
68 	__attribute__ ((__format__ (__printf__, _a, _b)))
69 #endif
70 #include <stdarg.h>
71 #ifndef __va_list
72 #define	__va_list	va_list
73 #endif
74 #define	OS_INLINE	__inline
75 #endif /* _ATH_AH_OSDEP_H_ */
76