xref: /freebsd/tools/tools/ath/common/ah_osdep.h (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
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, MERCHANTIBILITY
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 #ifndef _ATH_AH_OSDEP_H_
30 #define _ATH_AH_OSDEP_H_
31 /*
32  * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
33  */
34 #include <sys/param.h>
35 
36 #include <strings.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 typedef uint32_t HAL_DMA_ADDR;
45 
46 #define	OS_DELAY(_n)	DELAY(_n)
47 #define	OS_INLINE	__inline
48 #define	OS_MEMZERO(_a, _size)		bzero((_a), (_size))
49 #define	OS_MEMCPY(_dst, _src, _size)	bcopy((_src), (_dst), (_size))
50 #define	OS_MACEQU(_a, _b) \
51 	(bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
52 
53 struct ath_hal;
54 extern 	u_int32_t OS_GETUPTIME(struct ath_hal *);
55 extern	void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t);
56 extern	u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t);
57 extern	void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
58 #define	OS_GETUPTIME(_ah)	0
59 #define	OS_REG_WRITE(_ah, _reg, _val)
60 #define	OS_REG_READ(_ah, _reg)	0
61 #define	OS_MARK(_ah, _id, _v)
62 #define __packed __attribute__((__packed__))
63 
64 /*
65  * Linux/BSD gcc compatibility shims.
66  */
67 #ifndef __printflike
68 #define	__printflike(_a,_b) \
69 	__attribute__ ((__format__ (__printf__, _a, _b)))
70 #endif
71 #include <stdarg.h>
72 #ifndef __va_list
73 #define	__va_list	va_list
74 #endif
75 #define	OS_INLINE	__inline
76 #endif /* _ATH_AH_OSDEP_H_ */
77