1185743Ssam/*-
2185743Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3185743Ssam * All rights reserved.
4185743Ssam *
5185743Ssam * Redistribution and use in source and binary forms, with or without
6185743Ssam * modification, are permitted provided that the following conditions
7185743Ssam * are met:
8185743Ssam * 1. Redistributions of source code must retain the above copyright
9185743Ssam *    notice, this list of conditions and the following disclaimer,
10185743Ssam *    without modification.
11185743Ssam * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12185743Ssam *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13185743Ssam *    redistribution must be conditioned upon including a substantially
14185743Ssam *    similar Disclaimer requirement for further binary redistribution.
15185743Ssam *
16185743Ssam * NO WARRANTY
17185743Ssam * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18185743Ssam * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19185743Ssam * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20185743Ssam * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21185743Ssam * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22185743Ssam * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23185743Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24185743Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25185743Ssam * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26185743Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27185743Ssam * THE POSSIBILITY OF SUCH DAMAGES.
28185743Ssam *
29185743Ssam * $FreeBSD$
30185743Ssam */
31185743Ssam#ifndef _ATH_AH_OSDEP_H_
32185743Ssam#define _ATH_AH_OSDEP_H_
33185743Ssam/*
34185743Ssam * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
35185743Ssam */
36185743Ssam#include <sys/param.h>
37185743Ssam
38185743Ssam/*
39185743Ssam * Bus i/o type definitions.
40185743Ssam */
41185743Ssamtypedef void *HAL_SOFTC;
42185743Ssamtypedef int HAL_BUS_TAG;
43185743Ssamtypedef void *HAL_BUS_HANDLE;
44239162Sadriantypedef uint32_t HAL_DMA_ADDR;
45185743Ssam
46185743Ssam#define	OS_DELAY(_n)	DELAY(_n)
47185743Ssam#define	OS_INLINE	__inline
48185743Ssam#define	OS_MEMZERO(_a, _size)		bzero((_a), (_size))
49185743Ssam#define	OS_MEMCPY(_dst, _src, _size)	bcopy((_src), (_dst), (_size))
50185743Ssam#define	OS_MACEQU(_a, _b) \
51185743Ssam	(bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
52185743Ssam
53185743Ssamstruct ath_hal;
54185743Ssamextern 	u_int32_t OS_GETUPTIME(struct ath_hal *);
55185743Ssamextern	void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t);
56185743Ssamextern	u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t);
57185743Ssamextern	void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
58185743Ssam#define	OS_GETUPTIME(_ah)	0
59185743Ssam#define	OS_REG_WRITE(_ah, _reg, _val)
60185743Ssam#define	OS_REG_READ(_ah, _reg)	0
61185743Ssam#define	OS_MARK(_ah, _id, _v)
62185743Ssam#define __packed __attribute__((__packed__))
63185743Ssam
64185743Ssam/*
65185743Ssam * Linux/BSD gcc compatibility shims.
66185743Ssam */
67185743Ssam#ifndef __printflike
68185743Ssam#define	__printflike(_a,_b) \
69185743Ssam	__attribute__ ((__format__ (__printf__, _a, _b)))
70185743Ssam#endif
71185743Ssam#include <stdarg.h>
72185743Ssam#ifndef __va_list
73185743Ssam#define	__va_list	va_list
74185743Ssam#endif
75185743Ssam#define	OS_INLINE	__inline
76185743Ssam#endif /* _ATH_AH_OSDEP_H_ */
77